# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/android/config.gni")
import("//build/config/arm.gni")
import("//build/config/coverage/coverage.gni")
import("//build/config/dcheck_always_on.gni")
import("//build/config/host_byteorder.gni")
import("//build/config/mips.gni")
import("//build/config/riscv.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build_overrides/build.gni")

import("gni/snapshot_toolchain.gni")
import("gni/v8.gni")

# Specifies if the target build is a simulator build. Comparing target cpu
# with v8 target cpu to not affect simulator builds for making cross-compile
# snapshots.
target_is_simulator = (target_cpu != v8_target_cpu && !v8_multi_arch_build) ||
                      (current_cpu != v8_current_cpu && v8_multi_arch_build)

# For faster Windows builds. See https://crbug.com/v8/8475.
emit_builtins_as_inline_asm = is_win && is_clang

declare_args() {
  # Print to stdout on Android.
  v8_android_log_stdout = false

  # Dynamically set an additional dependency from v8/custom_deps.
  v8_custom_deps = ""

  # Turns on all V8 debug features. Enables running V8 in a pseudo debug mode
  # within a release Chrome.
  v8_enable_debugging_features = is_debug

  # Sets -DV8_ENABLE_FUTURE.
  v8_enable_future = false

  # Sets -DENABLE_SYSTEM_INSTRUMENTATION. Enables OS-dependent event tracing
  v8_enable_system_instrumentation = (is_win || is_mac) && !v8_use_perfetto

  # Sets -DV8_ENABLE_ETW_STACK_WALKING. Enables ETW Stack Walking
  v8_enable_etw_stack_walking = is_win

  # Sets the GUID for the ETW provider
  v8_etw_guid = ""

  # Sets -DVERIFY_HEAP.
  v8_enable_verify_heap = ""

  # Sets -DVERIFY_PREDICTABLE
  v8_enable_verify_predictable = false

  # Enable compiler warnings when using V8_DEPRECATED apis.
  v8_deprecation_warnings = true

  # Enable compiler warnings when using V8_DEPRECATE_SOON apis.
  v8_imminent_deprecation_warnings = true

  # Embeds the given script into the snapshot.
  v8_embed_script = ""

  # Allows the embedder to add a custom suffix to the version string.
  v8_embedder_string = ""

  # Sets -dENABLE_DISASSEMBLER.
  v8_enable_disassembler = ""

  # Sets the number of internal fields on promise objects.
  v8_promise_internal_field_count = 0

  # Sets -dENABLE_GDB_JIT_INTERFACE.
  v8_enable_gdbjit = ""

  # Sets -dENABLE_VTUNE_JIT_INTERFACE.
  v8_enable_vtunejit = false

  # Sets -dENABLE_VTUNE_TRACEMARK.
  v8_enable_vtunetracemark = false

  # Sets -dENABLE_HUGEPAGE
  v8_enable_hugepage = false

  # Sets -dV8_ENABLE_PRIVATE_MAPPING_FORK_OPTIMIZATION.
  #
  # This flag speeds up the performance of fork/execve on Linux systems for
  # embedders which use it (like Node.js). It works by marking the pages that
  # V8 allocates as MADV_DONTFORK. Without MADV_DONTFORK, the Linux kernel
  # spends a long time manipulating page mappings on fork and exec which the
  # child process doesn't generally need to access.
  #
  # See v8:7381 for more details.
  v8_enable_private_mapping_fork_optimization = false

  # Sets -dENABLE_HANDLE_ZAPPING.
  v8_enable_handle_zapping = is_asan || is_debug

  # Enable slow dchecks.
  v8_enable_slow_dchecks = false

  # Enable fast mksnapshot runs.
  v8_enable_fast_mksnapshot = false

  # Optimize code for Torque executable, even during a debug build.
  v8_enable_fast_torque = ""

  # Enable the registration of unwinding info for Windows x64 and ARM64.
  v8_win64_unwinding_info = true

  # Enable code comments for builtins in the snapshot (impacts performance).
  # This also enables v8_code_comments.
  v8_enable_snapshot_code_comments = false

  # Allow runtime-enabled code comments (with --code-comments). Enabled by
  # default in debug builds.
  # Sets -dV8_CODE_COMMENTS
  v8_code_comments = ""

  # Allow runtime-enabled debug code (with --debug-code). Enabled by default in
  # debug builds.
  # Sets -dV8_ENABLE_DEBUG_CODE
  v8_enable_debug_code = ""

  # Enable native counters from the snapshot (impacts performance, sets
  # -dV8_SNAPSHOT_NATIVE_CODE_COUNTERS).
  # This option will generate extra code in the snapshot to increment counters,
  # as per the --native-code-counters flag.
  v8_enable_snapshot_native_code_counters = ""

  # Use pre-generated static root pointer values from static-roots.h.
  v8_enable_static_roots = ""

  # Mode used by gen-static-roots.py to have a heap layout which is identical
  # to when v8_enable_static_roots is enabled.
  v8_enable_static_roots_generation = false

  # Enable code-generation-time checking of types in the CodeStubAssembler.
  v8_enable_verify_csa = false

  # Enable pointer compression (sets -dV8_COMPRESS_POINTERS).
  v8_enable_pointer_compression = ""
  v8_enable_pointer_compression_shared_cage = ""
  v8_enable_31bit_smis_on_64bit_arch = false

  # Sets -dOBJECT_PRINT.
  v8_enable_object_print = ""

  # Sets -dV8_TRACE_MAPS.
  v8_enable_trace_maps = ""

  # Sets -dV8_ENABLE_CHECKS.
  v8_enable_v8_checks = ""

  # Sets -dV8_TRACE_UNOPTIMIZED.
  v8_enable_trace_unoptimized = ""
  v8_enable_trace_ignition = false
  v8_enable_trace_baseline_exec = false

  # Sets -dV8_TRACE_FEEDBACK_UPDATES.
  v8_enable_trace_feedback_updates = false

  # Sets -dV8_ATOMIC_OBJECT_FIELD_WRITES and turns all field write operations
  # into relaxed atomic operations.
  v8_enable_atomic_object_field_writes = ""

  # Controls the default value of v8_enable_concurrent_marking_state. See the
  # default setting code below.
  v8_enable_concurrent_marking = true

  # Sets -dV8_IGNITION_DISPATCH_COUNTING.
  # Enables counting frequencies of bytecode dispatches. After building in this
  # configuration, subsequent runs of d8 can output frequencies for each pair
  # of (current, next) bytecode instructions executed if you specify
  # --trace-ignition-dispatches-output-file, or can generate a JS object with
  # those frequencies if you run with --expose-ignition-statistics and call the
  # extension function getIgnitionDispatchCounters().
  v8_enable_ignition_dispatch_counting = false

  # Runs mksnapshot with --turbo-profiling. After building in this
  # configuration, any subsequent run of d8 will output information about usage
  # of basic blocks in builtins.
  v8_enable_builtins_profiling = false

  # Runs mksnapshot with --turbo-profiling-verbose. After building in this
  # configuration, any subsequent run of d8 will output information about usage
  # of basic blocks in builtins, including the schedule and disassembly of all
  # used builtins.
  v8_enable_builtins_profiling_verbose = false

  # This build flag is used to input a builtin pgo file containing raw
  # execution counts (as opposed to branch hints), which are embedded into
  # the `--trace-turbo` .json file from `mksnapshot`.
  v8_log_builtins_block_count_input = ""

  # This build flag is used to control whether reorder builtins acoording to
  # the call graph with C3 algorithm based builtin PGO profiling.
  v8_enable_builtins_reordering = true

  # Provides the given V8 log file as an input to mksnapshot, where it can be
  # used for profile-guided optimization of builtins.
  #
  # To do profile-guided optimizations of builtins:
  # 1. Build with v8_enable_builtins_profiling = true
  # 2. Run your chosen workload with the --turbo-profiling-output flag.
  #    For Chrome, the invocation might look like this:
  #      chrome --no-sandbox --disable-extensions
  #        --js-flags="--turbo-profiling-output=v8.builtins.pgo"
  #        "http://localhost/test-suite"
  # 3. Run tools/builtins-pgo/get_hints.py to produce the branch hints,
  #    selecting min_count and threshold_ratio as you wish.
  # 4. Optionally repeat steps 2-3 for additional workloads, and use
  #    tools/builtins-pgo/combine_hints.py to combine the hints produced in
  #    step 3 into a single file.
  # 5. Build again with v8_builtins_profiling_log_file set to the file created
  #    in step 3 or 4.
  v8_builtins_profiling_log_file = "default"

  # Enables various testing features.
  v8_enable_test_features = ""

  # Enable short builtins call instruction sequences by un-embedding builtins.
  # Sets -dV8_SHORT_BUILTIN_CALLS
  v8_enable_short_builtin_calls = ""

  # Enable support for external code range relative to the pointer compression
  # cage.
  # Sets -dV8_EXTERNAL_CODE_SPACE
  v8_enable_external_code_space = ""

  # With post mortem support enabled, metadata is embedded into libv8 that
  # describes various parameters of the VM for use by debuggers. See
  # tools/gen-postmortem-metadata.py for details.
  v8_postmortem_support = false

  # Use Siphash as added protection against hash flooding attacks.
  v8_use_siphash = false

  # Switches off inlining in V8.
  v8_no_inline = false

  # Override OS page size when generating snapshot
  v8_os_page_size = "0"

  # Similar to vfp but on MIPS.
  v8_can_use_fpu_instructions = true

  # Similar to the ARM hard float ABI but on MIPS.
  v8_use_mips_abi_hardfloat = true

  # Controls the threshold for on-heap/off-heap Typed Arrays.
  v8_typed_array_max_size_in_heap = 64

  v8_enable_gdbjit = ((v8_current_cpu == "x86" || v8_current_cpu == "x64") &&
                      (is_linux || is_chromeos || is_mac)) ||
                     (v8_current_cpu == "ppc64" && (is_linux || is_chromeos))

  # Check that each header can be included in isolation (requires also
  # setting the "check_v8_header_includes" gclient variable to run a
  # specific hook).
  v8_check_header_includes = false

  # Enable sharing read-only space across isolates.
  # Sets -DV8_SHARED_RO_HEAP.
  v8_enable_shared_ro_heap = ""

  # Enable lazy source positions by default.
  v8_enable_lazy_source_positions = true

  # Enable third party HEAP library
  v8_enable_third_party_heap = false

  # Libaries used by third party heap
  v8_third_party_heap_libs = []

  # Source code used by third party heap
  v8_third_party_heap_files = []

  # Disable write barriers when GCs are non-incremental and
  # heap has single generation.
  v8_disable_write_barriers = false

  # Ensure that write barriers are always used.
  # Useful for debugging purposes.
  v8_enable_unconditional_write_barriers = false

  # Redirect allocation in young generation so that there will be
  # only one single generation.
  v8_enable_single_generation = ""

  # Use token threaded dispatch for the regular expression interpreter.
  # Use switch-based dispatch if this is false
  v8_enable_regexp_interpreter_threaded_dispatch = true

  # Enforce equality of builtins hashes from compatible architectures.
  v8_verify_builtins_compatibility = false

  # Check mksnapshot determinism by running it multiple times.
  v8_verify_deterministic_mksnapshot = false

  # Enable additional targets necessary for verification of torque
  # file generation
  v8_verify_torque_generation_invariance = false

  # Generate comments describing the Torque intermediate representation.
  v8_annotate_torque_ir = false

  # Enable snapshot compression (enabled by default for desktop) devices.
  v8_enable_snapshot_compression =
      target_os == "android" || target_os == "chromeos" ||
      target_os == "fuchsia"

  # Enable control-flow integrity features, such as pointer authentication for
  # ARM64. Enable it by default for simulator builds and when native code
  # supports it as well.
  v8_control_flow_integrity =
      v8_current_cpu == "arm64" &&
      (target_is_simulator || arm_control_flow_integrity != "none")

  # Enable heap reservation of size 4GB. Only possible for 64bit archs.
  cppgc_enable_caged_heap =
      v8_current_cpu == "x64" || v8_current_cpu == "arm64" ||
      v8_current_cpu == "loong64" || v8_current_cpu == "riscv64"

  # Enables additional heap verification phases and checks.
  cppgc_enable_verify_heap = ""

  # Enable allocations during prefinalizer invocations.
  cppgc_allow_allocations_in_prefinalizers = false

  # Enable V8 zone compression experimental feature.
  # Sets -DV8_COMPRESS_ZONES.
  v8_enable_zone_compression = ""

  # Enable the experimental V8 sandbox.
  # Sets -DV8_ENABLE_SANDBOX.
  v8_enable_sandbox = ""

  # Enable the memory corruption API. Useful for testing the sandbox.
  # The memory corruption API is only exposed to JavaScript if sandbox testing
  # mode is enabled at runtime, for example via --sandbox-fuzzing.
  # WARNING This will enable builtins that (by design) cause memory corruption.
  # Sets -DV8_ENABLE_MEMORY_CORRUPTION_API
  v8_enable_memory_corruption_api = false

  # Experimental feature for collecting per-class zone memory stats.
  # Requires use_rtti = true
  v8_enable_precise_zone_stats = false

  # Experimental feature that uses SwissNameDictionary instead of NameDictionary
  # as the backing store for all dictionary mode objects.
  v8_enable_swiss_name_dictionary = false

  # If enabled then macro definitions that are used in externally visible
  # header files are placed in a separate header file v8-gn.h.
  v8_generate_external_defines_header = false

  # Experimental feature for tracking constness of properties in non-global
  # dictionaries. Enabling this also always keeps prototypes in dict mode,
  # meaning that they are not switched to fast mode.
  # Sets -DV8_DICT_PROPERTY_CONST_TRACKING
  v8_dict_property_const_tracking = false

  # Enable map packing & unpacking (sets -dV8_MAP_PACKING).
  v8_enable_map_packing = false

  # Allow for JS promise hooks (instead of just C++).
  v8_enable_javascript_promise_hooks = false

  # Allow embedder data to be saved on continuations. Used to support
  # TaskAttribution and `scheduler.yield()`.
  # The flag enables disabling the feature, to test this data's overhead.
  v8_enable_continuation_preserved_embedder_data = true

  # Enable allocation folding globally (sets -dV8_ALLOCATION_FOLDING).
  # When it's disabled, the --turbo-allocation-folding runtime flag will be ignored.
  v8_enable_allocation_folding = true

  # Enable runtime verification of heap snapshots produced for devtools.
  v8_enable_heap_snapshot_verify = ""

  # Enable global allocation site tracking.
  v8_allocation_site_tracking = true

  # TODO(cbruni, v8:12302): Remove once API is migrated
  # Enable legacy mode for ScriptOrModule's lifetime. By default it's a
  # temporary object, if enabled it will be kept alive by the parent Script.
  # This is only used by nodejs.
  v8_scriptormodule_legacy_lifetime = false

  # Enables pointer compression for 8GB heaps.
  # Sets -DV8_COMPRESS_POINTERS_8GB.
  v8_enable_pointer_compression_8gb = ""

  # Compile V8 using zlib as dependency.
  # Sets -DV8_USE_ZLIB
  v8_use_zlib = true

  # Make ValueDeserializer crash if the data to deserialize is invalid.
  v8_value_deserializer_hard_fail = false

  # Enable jitless mode, including compile-time optimizations. Note that even
  # when this is set to 'false', one can run V8 in jitless mode at runtime by
  # passing the `--jitless` flag; but then you miss out on compile-time
  # optimizations.
  # iOS (non-simulator) does not have executable pages for 3rd party
  # applications yet so disable jit.
  v8_jitless = v8_enable_lite_mode || target_is_ios_device

  # Enable Sparkplug
  # Sets -DV8_ENABLE_SPARKPLUG.
  v8_enable_sparkplug = ""

  # Enable Maglev's graph printer.
  # Sets -DV8_ENABLE_MAGLEV_GRAPH_PRINTER.
  v8_enable_maglev_graph_printer = !build_with_chromium

  # Enable slow tracing, e.g., tracing on every instruction or Turbofan node.
  # Sets -DV8_ENABLE_SLOW_TRACING.
  v8_enable_slow_tracing = is_debug

  # Enable jump table switch for built-in.
  v8_enable_builtin_jump_table_switch = v8_current_cpu == "x64"

  v8_shortcut_strings_in_minor_ms = false

  # Whether custom embedder snapshots may extend (= allocate new objects in)
  # ReadOnlySpace.
  v8_enable_extensible_ro_snapshot = true
}

# Derived defaults.
if (cppgc_enable_verify_heap == "") {
  cppgc_enable_verify_heap = v8_enable_debugging_features || dcheck_always_on
}
if (v8_enable_verify_heap == "") {
  v8_enable_verify_heap = v8_enable_debugging_features
}
if (v8_enable_object_print == "") {
  v8_enable_object_print = v8_enable_debugging_features
}
if (v8_enable_disassembler == "") {
  v8_enable_disassembler = v8_enable_debugging_features
}
if (v8_enable_trace_maps == "") {
  v8_enable_trace_maps = v8_enable_debugging_features
}
if (v8_enable_test_features == "") {
  v8_enable_test_features = v8_enable_debugging_features || dcheck_always_on
}
if (v8_enable_v8_checks == "") {
  v8_enable_v8_checks = v8_enable_debugging_features
}
if (v8_enable_heap_snapshot_verify == "") {
  v8_enable_heap_snapshot_verify =
      v8_enable_debugging_features || dcheck_always_on
}
if (v8_enable_snapshot_code_comments) {
  assert(v8_code_comments == true || v8_code_comments == "",
         "v8_enable_snapshot_code_comments conflicts with v8_code_comments.")
  v8_code_comments = true
} else if (v8_code_comments == "") {
  v8_code_comments = v8_enable_debugging_features
}
if (v8_enable_debug_code == "") {
  v8_enable_debug_code = v8_enable_debugging_features
}
if (v8_enable_snapshot_native_code_counters == "") {
  v8_enable_snapshot_native_code_counters = v8_enable_debugging_features
}
if (v8_enable_pointer_compression == "") {
  v8_enable_pointer_compression =
      v8_current_cpu == "arm64" || v8_current_cpu == "x64"
}

# Toggle pointer compression for correctness fuzzing when building the
# clang_x64_pointer_compression toolchain. We'll correctness-compare the
# default build with the clang_x64_pointer_compression build.
if (v8_multi_arch_build &&
    rebase_path(get_label_info(":d8", "root_out_dir"), root_build_dir) ==
    "clang_x64_pointer_compression") {
  v8_enable_pointer_compression = !v8_enable_pointer_compression
}

# Ensure the sandbox is on/off in the same way as pointer compression for
# correctness fuzzing builds.
if (v8_multi_arch_build) {
  v8_enable_sandbox = v8_enable_pointer_compression
}
if (v8_enable_pointer_compression_shared_cage == "") {
  v8_enable_pointer_compression_shared_cage = v8_enable_pointer_compression
}
if (v8_enable_pointer_compression_8gb == "") {
  v8_enable_pointer_compression_8gb = false
}
if (v8_enable_fast_torque == "") {
  v8_enable_fast_torque = v8_enable_fast_mksnapshot
}
if (v8_enable_zone_compression == "") {
  v8_enable_zone_compression = false
}
if (v8_enable_short_builtin_calls == "") {
  v8_enable_short_builtin_calls =
      v8_current_cpu == "x64" || v8_current_cpu == "arm64"
}
if (v8_enable_external_code_space == "") {
  v8_enable_external_code_space =
      v8_enable_pointer_compression &&
      v8_enable_pointer_compression_shared_cage &&
      (v8_current_cpu == "x64" || v8_current_cpu == "arm64")
}
if (v8_enable_sparkplug == "") {
  v8_enable_sparkplug = !v8_jitless
}
if (v8_enable_maglev == "") {
  v8_enable_maglev = v8_enable_turbofan &&
                     (v8_current_cpu == "arm" || v8_current_cpu == "x64" ||
                      v8_current_cpu == "arm64")
}
assert(v8_enable_turbofan || !v8_enable_maglev,
       "Maglev is not available when Turbofan is disabled.")

assert(!v8_jitless || (!v8_enable_sparkplug && !v8_enable_maglev &&
                           !v8_enable_turbofan && !v8_enable_webassembly),
       "Sparkplug, Maglev, Turbofan and Wasm are not available in jitless mode")

if (v8_enable_single_generation == "") {
  v8_enable_single_generation = v8_disable_write_barriers
}
if (v8_enable_atomic_object_field_writes == "") {
  v8_enable_atomic_object_field_writes = v8_enable_concurrent_marking
}
if (v8_enable_third_party_heap) {
  v8_disable_write_barriers = true
  v8_enable_single_generation = true
  v8_enable_shared_ro_heap = false
  v8_enable_pointer_compression = false
  v8_enable_pointer_compression_shared_cage = false
  v8_enable_allocation_folding = false
}
if (v8_enable_single_generation) {
  v8_allocation_site_tracking = false
}
assert(!v8_enable_concurrent_marking || v8_enable_atomic_object_field_writes,
       "Concurrent marking requires atomic object field writes.")
if (v8_enable_trace_unoptimized == "") {
  v8_enable_trace_unoptimized =
      v8_enable_trace_ignition || v8_enable_trace_baseline_exec
}
assert(!v8_enable_trace_ignition || v8_enable_trace_unoptimized,
       "Ignition tracing requires unoptimized tracing to be enabled.")
assert(!v8_enable_trace_baseline_exec || v8_enable_trace_unoptimized,
       "Baseline tracing requires unoptimized tracing to be enabled.")
assert(
    v8_enable_debugging_features == true || dcheck_always_on ||
        !v8_enable_slow_dchecks,
    "v8_enable_slow_dchecks requires v8_enable_debugging_features or dcheck_always_on.")

if (v8_enable_short_builtin_calls &&
    (!v8_enable_pointer_compression && v8_current_cpu != "x64")) {
  # Disable short calls when pointer compression is not enabled, except x64,
  # where short builtin calls can still be enabled if the code range is
  # guaranteed to be close enough to embedded builtins.
  v8_enable_short_builtin_calls = false
}
if (v8_enable_shared_ro_heap == "") {
  v8_enable_shared_ro_heap = !v8_enable_pointer_compression ||
                             v8_enable_pointer_compression_shared_cage
}

if (v8_enable_sandbox == "") {
  # TODO(saelo, v8:11880) remove dependency on v8_enable_external_code_space
  # once that is enabled everywhere by default.
  # TODO(chromium:1325784) the sandbox is not currently supported in Chromium
  # on Fuchsia.
  v8_enable_sandbox = v8_enable_pointer_compression_shared_cage &&
                      v8_enable_external_code_space && target_os != "fuchsia"
}

if (v8_enable_static_roots == "") {
  # Static roots are only valid for builds with pointer compression and a
  # shared read-only heap.
  # TODO(olivf, v8:13466) Some configurations could be supported if we
  # introduce different static root files for different build configurations:
  # Non-wasm and non-i18n builds have fewer read only roots. Configurations
  # without external code space allocate read only roots at a further
  # location relative to the cage base.
  v8_enable_static_roots =
      v8_enable_pointer_compression && v8_enable_shared_ro_heap &&
      v8_enable_pointer_compression_shared_cage &&
      v8_enable_external_code_space && v8_enable_webassembly &&
      v8_enable_i18n_support
}

assert(!v8_enable_static_roots ||
           (v8_enable_pointer_compression && v8_enable_shared_ro_heap &&
                v8_enable_pointer_compression_shared_cage &&
                v8_enable_external_code_space && v8_enable_webassembly &&
                v8_enable_i18n_support),
       "Trying to enable static roots in a configuration that is not supported")

assert(
    !(v8_enable_static_roots && v8_enable_static_roots_generation),
    "Static root values must be generated in a build that does not rely on static roots itself")

if (v8_builtins_profiling_log_file == "default") {
  v8_builtins_profiling_log_file = ""

  # Don't use existing profile when
  # * v8_enable_builtins_optimization is disabled,
  # * generating a new one (i.e. v8_enable_builtins_profiling),
  # * is_debug or dcheck_always_on because they add more checks to the
  #   builtins control flow which we don't want to generate,
  # * !v8_enable_sandbox because it affects the way how external pointer values
  #   are accessed,
  # * v8_enable_webassembly because it changes the set of opcodes which affects
  #   graphs hashes,
  if (v8_enable_builtins_optimization && !v8_enable_builtins_profiling &&
      !is_debug && !dcheck_always_on && v8_enable_webassembly) {
    # This is about function arguments evaluation order, which makes node IDs
    # not predictable for subgraphs like Op1(Op2(), Op3()) and as a result
    # different graph hashes.
    # Clang uses left-to-right order everywhere except Windows, otherwise the
    # order is right-to-left.
    # TODO(crbug.com/v8/13647): Remove once this issue is fixed in CSA.
    if (!is_clang || is_win) {
      pgo_profile_suffix = "-rl"
    } else {
      pgo_profile_suffix = ""
    }
    if ((v8_current_cpu == "x64" || v8_current_cpu == "arm64") &&
        v8_enable_pointer_compression && v8_enable_external_code_space &&
        v8_enable_sandbox) {
      # Note, currently x64 profile can be applied to arm64 but not the other
      # way round.
      v8_builtins_profiling_log_file =
          "tools/builtins-pgo/profiles/x64" + pgo_profile_suffix + ".profile"
    } else if (v8_current_cpu == "x86" || v8_current_cpu == "arm") {
      # Note, x86 profile can be applied to arm but not the other way round.
      v8_builtins_profiling_log_file =
          "tools/builtins-pgo/profiles/x86" + pgo_profile_suffix + ".profile"
    }
  }
}

if (v8_enable_webassembly && !target_is_simulator && v8_current_cpu == "x64") {
  v8_enable_wasm_simd256_revec = true
}

assert(!v8_disable_write_barriers || v8_enable_single_generation,
       "Disabling write barriers works only with single generation")

assert(v8_current_cpu == "arm64" || !v8_control_flow_integrity,
       "Control-flow integrity is only supported on arm64")

if (v8_enable_shared_ro_heap && v8_enable_pointer_compression &&
    !v8_enable_pointer_compression_shared_cage) {
  assert(
      is_linux || is_chromeos || is_android,
      "Sharing read-only heap with pointer compression is only supported on Linux or Android")
}

assert(!v8_enable_map_packing || !v8_enable_pointer_compression,
       "Map packing does not support pointer compression")

assert(!v8_enable_map_packing || v8_current_cpu == "x64",
       "Map packing is only supported on x64")

assert(!v8_enable_external_code_space || v8_enable_pointer_compression,
       "External code space feature requires pointer compression")

assert(!v8_enable_pointer_compression_8gb || v8_enable_pointer_compression,
       "Pointer compression for 8GB cages requires pointer compression")

assert(!v8_enable_sandbox || v8_enable_pointer_compression_shared_cage,
       "The sandbox requires the shared pointer compression cage")

assert(!v8_enable_sandbox || v8_enable_external_code_space,
       "The sandbox requires the external code space")

assert(!v8_enable_sandbox || !v8_enable_third_party_heap,
       "The sandbox is incompatible with the third-party heap")

assert(!v8_enable_memory_corruption_api || v8_enable_sandbox,
       "The Memory Corruption API requires the sandbox")

assert(
    !v8_enable_pointer_compression_shared_cage || v8_enable_pointer_compression,
    "Can't share a pointer compression cage if pointers aren't compressed")

assert(
    !v8_enable_pointer_compression ||
        v8_enable_pointer_compression_shared_cage ||
        !v8_enable_external_code_space,
    "Multi-cage pointer compression mode is not compatible with external code space")

assert(
    !v8_enable_pointer_compression_shared_cage || v8_current_cpu == "x64" ||
        v8_current_cpu == "arm64" || v8_current_cpu == "riscv64" ||
        v8_current_cpu == "ppc64" || v8_current_cpu == "s390x" ||
        v8_current_cpu == "loong64",
    "Sharing a pointer compression cage is only supported on x64, arm64, ppc64, s390x, riscv64 and loong64")

assert(!v8_enable_unconditional_write_barriers || !v8_disable_write_barriers,
       "Write barriers can't be both enabled and disabled")

assert(!cppgc_enable_caged_heap || v8_current_cpu == "x64" ||
           v8_current_cpu == "arm64" || v8_current_cpu == "loong64" ||
           v8_current_cpu == "riscv64",
       "CppGC caged heap requires 64bit platforms")

assert(!cppgc_enable_young_generation || cppgc_enable_caged_heap,
       "Young generation in CppGC requires caged heap")

assert(!cppgc_enable_pointer_compression || cppgc_enable_caged_heap,
       "Pointer compression in CppGC requires caged heap")

if (v8_enable_single_generation == true) {
  assert(
      v8_enable_unconditional_write_barriers || v8_disable_write_barriers,
      "Requires unconditional write barriers or none (which disables incremental marking)")
}

assert(!v8_enable_snapshot_compression || v8_use_zlib,
       "Snapshot compression requires zlib")

if (v8_expose_public_symbols == "") {
  v8_expose_public_symbols = v8_expose_symbols
}

v8_random_seed = "314159265"
v8_toolset_for_shell = "host"

###############################################################################
# Configurations
#

config("internal_config_base") {
  # Only targets in this file and its subdirs can depend on this.
  visibility = [ "./*" ]

  configs = [ ":v8_tracing_config" ]

  include_dirs = [
    ".",
    "include",
    "$target_gen_dir",
  ]
}

config("internal_config") {
  defines = []

  # Only targets in this file and its subdirs can depend on this.
  visibility = [ "./*" ]

  configs = [
    "//build/config/compiler:wexit_time_destructors",
    ":internal_config_base",
    ":v8_header_features",
    ":cppgc_header_features",
  ]

  if (is_component_build) {
    defines += [ "BUILDING_V8_SHARED_PRIVATE" ]
  } else if (v8_expose_public_symbols) {
    defines += [ "BUILDING_V8_SHARED" ]
  }

  if (v8_current_cpu == "riscv64" || v8_current_cpu == "riscv32") {
    if (!is_clang) {
      libs = [ "atomic" ]
    }
  }
}

# Should be applied to all targets that write trace events.
config("v8_tracing_config") {
  if (v8_use_perfetto) {
    include_dirs = [
      "//third_party/perfetto/include",
      "$root_gen_dir/third_party/perfetto",
      "$root_gen_dir/third_party/perfetto/build_config",
    ]
  }
}

# This config should be applied to code using the libplatform.
config("libplatform_config") {
  include_dirs = [ "include" ]
  if (is_component_build) {
    defines = [ "USING_V8_PLATFORM_SHARED" ]
  }
}

# This config should be applied to code using the libbase.
config("libbase_config") {
  if (is_component_build) {
    defines = [ "USING_V8_BASE_SHARED" ]
  }
  libs = []
  if (is_android && current_toolchain != host_toolchain) {
    libs += [ "log" ]
  }
}

# Standalone cppgc cannot be built within chrome or with perfetto.
assert(!cppgc_is_standalone || !build_with_chromium)
assert(!cppgc_is_standalone || !v8_use_perfetto)

# This config should be applied to code using the cppgc_base.
config("cppgc_base_config") {
  defines = []
  if (cppgc_is_standalone) {
    defines += [ "CPPGC_IS_STANDALONE" ]
  }
}

# This config is only applied to v8_headers and is the basis for external_config
# but without setting the USING_V8_SHARED define, which means v8_headers can be
# used inside v8 itself.
config("headers_config") {
  defines = []
  configs = [
    ":v8_header_features",
    ":cppgc_header_features",
  ]
  include_dirs = [ "include" ]
}

# This config should only be applied to code using V8 and not any V8 code
# itself.
config("external_config") {
  configs = [ ":headers_config" ]
  defines = []
  if (is_component_build) {
    defines += [
      "USING_V8_SHARED",
      "USING_V8_SHARED_PRIVATE",
    ]
  }

  if (current_cpu == "riscv64" || current_cpu == "riscv32") {
    if (!is_clang) {
      libs = [ "atomic" ]
    }
  }
}

# This config should only be applied to code that needs to be explicitly
# aware of whether we are using startup data or not.
config("external_startup_data") {
  if (v8_use_external_startup_data) {
    defines = [ "V8_USE_EXTERNAL_STARTUP_DATA" ]
  }
}

# List of defines that can appear in externally visible header files and that
# are controlled by args.gn.
# Make sure the |v8_generate_features_json| action is also updated when adding
# or removing defines below.
external_v8_defines = [
  "V8_ENABLE_CHECKS",
  "V8_COMPRESS_POINTERS",
  "V8_COMPRESS_POINTERS_IN_SHARED_CAGE",
  "V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE",
  "V8_31BIT_SMIS_ON_64BIT_ARCH",
  "V8_COMPRESS_ZONES",
  "V8_ENABLE_SANDBOX",
  "V8_DEPRECATION_WARNINGS",
  "V8_IMMINENT_DEPRECATION_WARNINGS",
  "V8_USE_PERFETTO",
  "V8_MAP_PACKING",
  "V8_IS_TSAN",
  "V8_ENABLE_CONSERVATIVE_STACK_SCANNING",
  "V8_ENABLE_DIRECT_LOCAL",
]

enabled_external_v8_defines = []

if (v8_enable_v8_checks) {
  enabled_external_v8_defines += [ "V8_ENABLE_CHECKS" ]
}
if (v8_enable_pointer_compression) {
  enabled_external_v8_defines += [ "V8_COMPRESS_POINTERS" ]
  if (v8_enable_pointer_compression_shared_cage) {
    enabled_external_v8_defines += [ "V8_COMPRESS_POINTERS_IN_SHARED_CAGE" ]
  } else {
    enabled_external_v8_defines += [ "V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE" ]
  }
}
if (v8_enable_pointer_compression || v8_enable_31bit_smis_on_64bit_arch) {
  enabled_external_v8_defines += [ "V8_31BIT_SMIS_ON_64BIT_ARCH" ]
}
if (v8_enable_zone_compression) {
  enabled_external_v8_defines += [ "V8_COMPRESS_ZONES" ]
}
if (v8_enable_sandbox) {
  enabled_external_v8_defines += [ "V8_ENABLE_SANDBOX" ]
}
if (v8_deprecation_warnings) {
  enabled_external_v8_defines += [ "V8_DEPRECATION_WARNINGS" ]
}
if (v8_imminent_deprecation_warnings) {
  enabled_external_v8_defines += [ "V8_IMMINENT_DEPRECATION_WARNINGS" ]
}
if (v8_use_perfetto) {
  enabled_external_v8_defines += [ "V8_USE_PERFETTO" ]
}
if (v8_enable_map_packing) {
  enabled_external_v8_defines += [ "V8_MAP_PACKING" ]
}
if (is_tsan) {
  enabled_external_v8_defines += [ "V8_IS_TSAN" ]
}
if (v8_enable_conservative_stack_scanning) {
  enabled_external_v8_defines += [ "V8_ENABLE_CONSERVATIVE_STACK_SCANNING" ]
}
if (v8_enable_direct_local) {
  enabled_external_v8_defines += [ "V8_ENABLE_DIRECT_LOCAL" ]
}
if (v8_shortcut_strings_in_minor_ms) {
  enabled_external_v8_defines += [ "V8_MINORMS_STRING_SHORTCUTTING" ]
}
disabled_external_v8_defines = external_v8_defines - enabled_external_v8_defines

# Put defines that are used in public headers here; public headers are
# defined in "v8_headers" and are included by embedders of V8.
config("v8_header_features") {
  visibility = [ ":*" ]

  if (v8_generate_external_defines_header) {
    defines = [ "V8_GN_HEADER" ]
  } else {
    defines = enabled_external_v8_defines
  }
}

# List of defines that can appear in externally visible cppgc header files and
# that are controlled by args.gn.
external_cppgc_defines = [
  "CPPGC_SUPPORTS_OBJECT_NAMES",
  "CPPGC_CAGED_HEAP",
  "CPPGC_SLIM_WRITE_BARRIER",
  "CPPGC_YOUNG_GENERATION",
  "CPPGC_POINTER_COMPRESSION",
  "CPPGC_ENABLE_LARGER_CAGE",
]

enabled_external_cppgc_defines = []

if (cppgc_enable_object_names) {
  enabled_external_cppgc_defines += [ "CPPGC_SUPPORTS_OBJECT_NAMES" ]
}
if (cppgc_enable_caged_heap) {
  enabled_external_cppgc_defines += [ "CPPGC_CAGED_HEAP" ]

  # Always enable young generation compile time flag if caged heap is enabled.
  cppgc_enable_young_generation = true

  # Pointer compression regresses binary size on Fuchsia by about 300K.
  # However, the change improves Oilpan memory by 15-20% (2-4% of PMF),
  # which is beneficial for memory-impoverished platforms.
  cppgc_enable_pointer_compression = true
}
if (cppgc_enable_young_generation) {
  enabled_external_cppgc_defines += [ "CPPGC_YOUNG_GENERATION" ]
}
if (cppgc_enable_pointer_compression) {
  enabled_external_cppgc_defines += [ "CPPGC_POINTER_COMPRESSION" ]
}
if (cppgc_enable_2gb_cage) {
  enabled_external_cppgc_defines += [ "CPPGC_2GB_CAGE" ]
}
if (cppgc_enable_larger_cage) {
  enabled_external_cppgc_defines += [ "CPPGC_ENABLE_LARGER_CAGE" ]
}
if (cppgc_enable_slim_write_barrier) {
  enabled_external_cppgc_defines += [ "CPPGC_SLIM_WRITE_BARRIER" ]
}

disabled_external_cppgc_defines =
    external_cppgc_defines - enabled_external_cppgc_defines

config("cppgc_header_features") {
  visibility = [ ":*" ]

  if (v8_generate_external_defines_header) {
    defines = [ "V8_GN_HEADER" ]
  } else {
    defines = enabled_external_cppgc_defines
  }
}

enabled_external_defines =
    enabled_external_v8_defines + enabled_external_cppgc_defines
disabled_external_defines =
    disabled_external_v8_defines + disabled_external_cppgc_defines

# Put defines here that are only used in our internal files and NEVER in
# external headers that embedders (such as chromium and node) might include.
config("features") {
  # Only targets in this file and its subdirs can depend on this.
  visibility = [ "./*" ]

  defines = []

  configs = [
    ":v8_header_features",
    ":cppgc_header_features",
  ]

  if (cppgc_enable_verify_heap) {
    defines += [ "CPPGC_VERIFY_HEAP" ]
  }

  if (cppgc_allow_allocations_in_prefinalizers) {
    defines += [ "CPPGC_ALLOW_ALLOCATIONS_IN_PREFINALIZERS" ]
  }

  if (v8_embedder_string != "") {
    defines += [ "V8_EMBEDDER_STRING=\"$v8_embedder_string\"" ]
  }
  if (v8_enable_disassembler || v8_log_builtins_block_count_input != "") {
    defines += [ "ENABLE_DISASSEMBLER" ]
  }
  if (v8_log_builtins_block_count_input != "") {
    defines += [ "LOG_BUILTIN_BLOCK_COUNT" ]
  }
  if (v8_promise_internal_field_count != 0) {
    defines +=
        [ "V8_PROMISE_INTERNAL_FIELD_COUNT=${v8_promise_internal_field_count}" ]
  }
  defines +=
      [ "V8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=${v8_typed_array_max_size_in_heap}" ]

  if (v8_enable_future) {
    defines += [ "V8_ENABLE_FUTURE" ]
  }
  if (v8_enable_lite_mode) {
    defines += [ "V8_LITE_MODE" ]
  }
  if (v8_enable_gdbjit) {
    defines += [ "ENABLE_GDB_JIT_INTERFACE" ]
  }
  if (v8_enable_vtunejit) {
    defines += [ "ENABLE_VTUNE_JIT_INTERFACE" ]
  }
  if (v8_enable_vtunetracemark) {
    defines += [ "ENABLE_VTUNE_TRACEMARK" ]
  }
  if (v8_enable_hugepage) {
    defines += [ "ENABLE_HUGEPAGE" ]
  }
  if (v8_enable_private_mapping_fork_optimization) {
    defines += [ "V8_ENABLE_PRIVATE_MAPPING_FORK_OPTIMIZATION" ]
  }
  if (v8_enable_object_print) {
    defines += [ "OBJECT_PRINT" ]
  }
  if (v8_enable_verify_heap) {
    defines += [ "VERIFY_HEAP" ]
  }
  if (v8_enable_verify_predictable) {
    defines += [ "VERIFY_PREDICTABLE" ]
  }
  if (v8_enable_trace_maps) {
    defines += [ "V8_TRACE_MAPS" ]
  }
  if (v8_enable_trace_unoptimized) {
    defines += [ "V8_TRACE_UNOPTIMIZED" ]
  }
  if (v8_enable_trace_feedback_updates) {
    defines += [ "V8_TRACE_FEEDBACK_UPDATES" ]
  }
  if (v8_enable_test_features) {
    defines += [ "V8_ENABLE_ALLOCATION_TIMEOUT" ]
    defines += [ "V8_ENABLE_FORCE_SLOW_PATH" ]
    defines += [ "V8_ENABLE_DOUBLE_CONST_STORE_CHECK" ]
  }
  if (v8_enable_i18n_support) {
    defines += [ "V8_INTL_SUPPORT" ]
  }
  if (v8_enable_handle_zapping) {
    defines += [ "ENABLE_HANDLE_ZAPPING" ]
  }
  if (v8_code_comments == true) {
    defines += [ "V8_CODE_COMMENTS" ]
  }
  if (v8_enable_debug_code) {
    defines += [ "V8_ENABLE_DEBUG_CODE" ]
  }
  if (v8_enable_heap_snapshot_verify) {
    defines += [ "V8_ENABLE_HEAP_SNAPSHOT_VERIFY" ]
  }
  if (v8_enable_snapshot_native_code_counters) {
    defines += [ "V8_SNAPSHOT_NATIVE_CODE_COUNTERS" ]
  }
  if (v8_enable_single_generation) {
    defines += [ "V8_ENABLE_SINGLE_GENERATION" ]
  }
  if (v8_disable_write_barriers) {
    defines += [ "V8_DISABLE_WRITE_BARRIERS" ]
  }
  if (v8_enable_third_party_heap) {
    defines += [ "V8_ENABLE_THIRD_PARTY_HEAP" ]
  }
  if (v8_use_external_startup_data) {
    defines += [ "V8_USE_EXTERNAL_STARTUP_DATA" ]
  }
  if (v8_enable_atomic_object_field_writes) {
    defines += [ "V8_ATOMIC_OBJECT_FIELD_WRITES" ]
  }
  if (v8_enable_ignition_dispatch_counting) {
    defines += [ "V8_IGNITION_DISPATCH_COUNTING" ]
  }
  if (v8_enable_lazy_source_positions) {
    defines += [ "V8_ENABLE_LAZY_SOURCE_POSITIONS" ]
  }
  if (v8_use_siphash) {
    defines += [ "V8_USE_SIPHASH" ]
  }
  if (v8_enable_shared_ro_heap) {
    defines += [ "V8_SHARED_RO_HEAP" ]
  }
  if (v8_win64_unwinding_info) {
    defines += [ "V8_WIN64_UNWINDING_INFO" ]
  }
  if (v8_enable_regexp_interpreter_threaded_dispatch) {
    defines += [ "V8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH" ]
  }
  if (v8_enable_snapshot_compression) {
    defines += [ "V8_SNAPSHOT_COMPRESSION" ]
  }
  if (v8_control_flow_integrity) {
    defines += [ "V8_ENABLE_CONTROL_FLOW_INTEGRITY" ]
  }
  if (v8_enable_cet_shadow_stack) {
    defines += [ "V8_ENABLE_CET_SHADOW_STACK" ]
  }
  if (v8_enable_cet_ibt) {
    defines += [ "V8_ENABLE_CET_IBT" ]
  }
  if (v8_enable_wasm_gdb_remote_debugging) {
    defines += [ "V8_ENABLE_WASM_GDB_REMOTE_DEBUGGING" ]
  }
  if (v8_enable_precise_zone_stats) {
    defines += [ "V8_ENABLE_PRECISE_ZONE_STATS" ]
  }
  if (v8_fuzzilli) {
    defines += [ "V8_FUZZILLI" ]
  }
  if (v8_enable_fuzztest) {
    defines += [ "V8_ENABLE_FUZZTEST" ]
  }
  if (v8_enable_short_builtin_calls) {
    defines += [ "V8_SHORT_BUILTIN_CALLS" ]
  }
  if (v8_enable_external_code_space) {
    defines += [ "V8_EXTERNAL_CODE_SPACE" ]
  }
  if (v8_enable_sparkplug) {
    defines += [ "V8_ENABLE_SPARKPLUG" ]
  }
  if (v8_enable_maglev) {
    defines += [ "V8_ENABLE_MAGLEV" ]
  }
  if (v8_enable_turbofan) {
    defines += [ "V8_ENABLE_TURBOFAN" ]
  }
  if (v8_jitless) {
    defines += [ "V8_JITLESS" ]
  }
  if (v8_enable_swiss_name_dictionary) {
    defines += [ "V8_ENABLE_SWISS_NAME_DICTIONARY" ]
  }
  if (v8_enable_system_instrumentation) {
    defines += [ "V8_ENABLE_SYSTEM_INSTRUMENTATION" ]
  }
  if (v8_enable_etw_stack_walking) {
    defines += [ "V8_ENABLE_ETW_STACK_WALKING" ]
  }
  if (v8_etw_guid != "") {
    defines += [ "V8_ETW_GUID=\"$v8_etw_guid\"" ]
  }
  if (v8_enable_webassembly) {
    defines += [ "V8_ENABLE_WEBASSEMBLY" ]
  }
  if (v8_dict_property_const_tracking) {
    defines += [ "V8_DICT_PROPERTY_CONST_TRACKING" ]
  }
  if (v8_enable_javascript_promise_hooks) {
    defines += [ "V8_ENABLE_JAVASCRIPT_PROMISE_HOOKS" ]
  }
  if (v8_enable_continuation_preserved_embedder_data) {
    defines += [ "V8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA" ]
  }
  if (v8_enable_allocation_folding) {
    defines += [ "V8_ALLOCATION_FOLDING" ]
  }
  if (v8_allocation_site_tracking) {
    defines += [ "V8_ALLOCATION_SITE_TRACKING" ]
  }
  if (v8_scriptormodule_legacy_lifetime) {
    defines += [ "V8_SCRIPTORMODULE_LEGACY_LIFETIME" ]
  }
  if (v8_advanced_bigint_algorithms) {
    defines += [ "V8_ADVANCED_BIGINT_ALGORITHMS" ]
  }
  if (v8_enable_memory_corruption_api) {
    defines += [ "V8_ENABLE_MEMORY_CORRUPTION_API" ]
  }
  if (v8_enable_pointer_compression_8gb) {
    defines += [ "V8_COMPRESS_POINTERS_8GB" ]
  }
  if (v8_enable_static_roots) {
    defines += [ "V8_STATIC_ROOTS" ]
  }
  if (v8_enable_static_roots_generation) {
    defines += [ "V8_STATIC_ROOTS_GENERATION" ]
  }
  if (v8_use_zlib) {
    defines += [ "V8_USE_ZLIB" ]
  }
  if (v8_use_libm_trig_functions) {
    defines += [ "V8_USE_LIBM_TRIG_FUNCTIONS" ]
  }
  if (v8_value_deserializer_hard_fail) {
    defines += [ "V8_VALUE_DESERIALIZER_HARD_FAIL" ]
  }
  if (v8_enable_wasm_simd256_revec) {
    defines += [ "V8_ENABLE_WASM_SIMD256_REVEC" ]
  }
  if (v8_enable_maglev_graph_printer) {
    defines += [ "V8_ENABLE_MAGLEV_GRAPH_PRINTER" ]
  }
  if (v8_enable_slow_tracing) {
    defines += [ "V8_ENABLE_SLOW_TRACING" ]
  }
  if (v8_enable_builtin_jump_table_switch) {
    defines += [ "V8_ENABLE_BUILTIN_JUMP_TABLE_SWITCH" ]
  }
  if (v8_enable_direct_handle) {
    defines += [ "V8_ENABLE_DIRECT_HANDLE" ]
  }
  if (v8_enable_extensible_ro_snapshot) {
    defines += [ "V8_ENABLE_EXTENSIBLE_RO_SNAPSHOT" ]
  }
  if (v8_enable_local_off_stack_check) {
    defines += [ "V8_ENABLE_LOCAL_OFF_STACK_CHECK" ]
  }
}

config("toolchain") {
  # Only targets in this file and its subdirs can depend on this.
  visibility = [ "./*" ]

  defines = []
  cflags = []
  ldflags = []

  if (v8_current_cpu == "arm") {
    defines += [ "V8_TARGET_ARCH_ARM" ]
    if (arm_version >= 7) {
      defines += [ "CAN_USE_ARMV7_INSTRUCTIONS" ]
    }
    if (arm_fpu == "vfpv3-d16") {
      defines += [ "CAN_USE_VFP3_INSTRUCTIONS" ]
    } else if (arm_fpu == "vfpv3") {
      defines += [
        "CAN_USE_VFP3_INSTRUCTIONS",
        "CAN_USE_VFP32DREGS",
      ]
    } else if (arm_fpu == "neon") {
      defines += [
        "CAN_USE_VFP3_INSTRUCTIONS",
        "CAN_USE_VFP32DREGS",
        "CAN_USE_NEON",
      ]
    }

    # TODO(infra): Add support for arm_test_noprobe.

    if (current_cpu != "arm") {
      # These defines ares used for the ARM simulator.
      if (arm_float_abi == "hard") {
        defines += [ "USE_EABI_HARDFLOAT=1" ]
      } else if (arm_float_abi == "softfp") {
        defines += [ "USE_EABI_HARDFLOAT=0" ]
      }
    }
  }
  if (v8_current_cpu == "arm64") {
    defines += [ "V8_TARGET_ARCH_ARM64" ]
    if (current_cpu == "arm64" && v8_control_flow_integrity && is_clang) {
      # Mark assembly code as BTI-compatible.
      asmflags = [ "-mmark-bti-property" ]
    }
  }

  # Mips64el simulators.
  if (target_is_simulator && v8_current_cpu == "mips64el") {
    defines += [ "_MIPS_TARGET_SIMULATOR" ]
  }

  if (v8_current_cpu == "mips64el" || v8_current_cpu == "mips64") {
    defines += [ "V8_TARGET_ARCH_MIPS64" ]
    if (v8_can_use_fpu_instructions) {
      defines += [ "CAN_USE_FPU_INSTRUCTIONS" ]
    }
    if (mips_use_msa) {
      defines += [ "_MIPS_MSA" ]
    }
    if (host_byteorder == "little") {
      defines += [ "V8_TARGET_ARCH_MIPS64_LE" ]
    } else if (host_byteorder == "big") {
      defines += [ "V8_TARGET_ARCH_MIPS64_BE" ]
    }
    if (v8_use_mips_abi_hardfloat) {
      defines += [
        "__mips_hard_float=1",
        "CAN_USE_FPU_INSTRUCTIONS",
      ]
    } else {
      defines += [ "__mips_soft_float=1" ]
    }
    if (mips_arch_variant == "r6") {
      defines += [ "_MIPS_ARCH_MIPS64R6" ]
    } else if (mips_arch_variant == "r2") {
      defines += [ "_MIPS_ARCH_MIPS64R2" ]
    }
  }

  # loong64 simulators.
  if (target_is_simulator && v8_current_cpu == "loong64") {
    defines += [ "_LOONG64_TARGET_SIMULATOR" ]
  }
  if (v8_current_cpu == "loong64") {
    defines += [ "V8_TARGET_ARCH_LOONG64" ]
  }

  if (v8_current_cpu == "s390" || v8_current_cpu == "s390x") {
    defines += [ "V8_TARGET_ARCH_S390" ]
    cflags += [ "-ffp-contract=off" ]
    if (v8_current_cpu == "s390x") {
      defines += [ "V8_TARGET_ARCH_S390X" ]
    }
    if (host_byteorder == "little") {
      defines += [ "V8_TARGET_ARCH_S390_LE_SIM" ]
    } else {
      cflags += [ "-march=z196" ]
    }
  }
  if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64") {
    if (v8_current_cpu == "ppc") {
      defines += [ "V8_TARGET_ARCH_PPC" ]
    } else if (v8_current_cpu == "ppc64") {
      defines += [ "V8_TARGET_ARCH_PPC64" ]
      cflags += [ "-ffp-contract=off" ]
    }
    if (host_byteorder == "little") {
      defines += [ "V8_TARGET_ARCH_PPC_LE" ]
    } else if (host_byteorder == "big") {
      defines += [ "V8_TARGET_ARCH_PPC_BE" ]
      if (current_os == "aix") {
        cflags += [
          # Work around AIX ceil, trunc and round oddities.
          "-mcpu=power5+",
          "-mfprnd",

          # Work around AIX assembler popcntb bug.
          "-mno-popcntb",
        ]
      }
    }
  }

  # Under simulator build, compiler will not provide __riscv_xlen. Define here
  if (v8_current_cpu == "riscv64" || v8_current_cpu == "riscv32") {
    if (riscv_use_rvv || target_is_simulator) {
      defines += [ "CAN_USE_RVV_INSTRUCTIONS" ]
      defines += [ "RVV_VLEN=${riscv_rvv_vlen}" ]
    }
    if (riscv_use_zba || target_is_simulator) {
      defines += [ "CAN_USE_ZBA_INSTRUCTIONS" ]
    }
    if (riscv_use_zbb || target_is_simulator) {
      defines += [ "CAN_USE_ZBB_INSTRUCTIONS" ]
    }
    if (riscv_use_zbs || target_is_simulator) {
      defines += [ "CAN_USE_ZBS_INSTRUCTIONS" ]
    }
  }
  if (v8_current_cpu == "riscv64") {
    defines += [ "V8_TARGET_ARCH_RISCV64" ]
    defines += [ "__riscv_xlen=64" ]
    defines += [ "CAN_USE_FPU_INSTRUCTIONS" ]
    if (!is_clang) {
      cflags += [ "-ffp-contract=off" ]
    }
  }

  if (v8_current_cpu == "riscv32") {
    defines += [ "V8_TARGET_ARCH_RISCV32" ]
    defines += [ "__riscv_xlen=32" ]
    defines += [ "CAN_USE_FPU_INSTRUCTIONS" ]
  }

  if (v8_current_cpu == "x86") {
    defines += [ "V8_TARGET_ARCH_IA32" ]
    if (is_win) {
      # Ensure no surprising artifacts from 80bit double math with x86.
      cflags += [ "/arch:SSE2" ]
    }
  }
  if (v8_current_cpu == "x64") {
    defines += [ "V8_TARGET_ARCH_X64" ]
    if (is_win) {
      # Increase the initial stack size. The default is 1MB, this is 2MB. This
      # applies only to executables and shared libraries produced by V8 since
      # ldflags are not pushed to dependants.
      ldflags += [ "/STACK:2097152" ]
    }
  }
  if (is_android && v8_android_log_stdout) {
    defines += [ "V8_ANDROID_LOG_STDOUT" ]
  }

  # V8_TARGET_OS_ defines. The target OS may differ from host OS e.g. in
  # mksnapshot. We additionally set V8_HAVE_TARGET_OS to determine that a
  # target OS has in fact been set; otherwise we internally assume that target
  # OS == host OS (see v8config.h).
  if (target_os == "android") {
    defines += [ "V8_HAVE_TARGET_OS" ]
    defines += [ "V8_TARGET_OS_ANDROID" ]
  } else if (target_os == "fuchsia") {
    defines += [ "V8_HAVE_TARGET_OS" ]
    defines += [ "V8_TARGET_OS_FUCHSIA" ]
  } else if (target_os == "ios") {
    defines += [ "V8_HAVE_TARGET_OS" ]
    defines += [ "V8_TARGET_OS_IOS" ]
  } else if (target_os == "linux") {
    defines += [ "V8_HAVE_TARGET_OS" ]
    defines += [ "V8_TARGET_OS_LINUX" ]
  } else if (target_os == "mac") {
    defines += [ "V8_HAVE_TARGET_OS" ]
    defines += [ "V8_TARGET_OS_MACOS" ]
  } else if (target_os == "win") {
    defines += [ "V8_HAVE_TARGET_OS" ]
    defines += [ "V8_TARGET_OS_WIN" ]
  } else if (target_os == "chromeos") {
    defines += [ "V8_HAVE_TARGET_OS" ]
    defines += [ "V8_TARGET_OS_CHROMEOS" ]
  }

  # TODO(infra): Support v8_enable_prof on Windows.
  # TODO(infra): Add support for compiling with simulators.

  if (v8_enable_debugging_features || dcheck_always_on) {
    defines += [ "DEBUG" ]
    if (v8_enable_slow_dchecks) {
      defines += [ "ENABLE_SLOW_DCHECKS" ]
    }
  } else {
    defines += [ "NDEBUG" ]
  }

  if (v8_enable_verify_csa) {
    defines += [ "ENABLE_VERIFY_CSA" ]
  }

  if (v8_enable_runtime_call_stats) {
    defines += [ "V8_RUNTIME_CALL_STATS" ]
  }

  if (v8_no_inline) {
    if (is_win) {
      cflags += [ "/Ob0" ]
    } else {
      cflags += [
        "-fno-inline-functions",
        "-fno-inline",
      ]
    }
  }

  if (is_clang) {
    cflags += [
      "-Wunreachable-code",

      # TODO(v8:12245): Fix shadowing instances and remove.
      "-Wno-shadow",
    ]

    # TODO(fuchsia:127411): Re-enable once FIDL bindings are compatible.
    if (!is_fuchsia) {
      # Google3 enables this warning, so we should also enable it to find issue
      # earlier. See https://reviews.llvm.org/D56731 for details about this
      # warning.
      cflags += [ "-Wctad-maybe-unsupported" ]
    }
  }

  if (is_clang || !is_win) {
    cflags += [
      # On clang and gcc, disable warnings about offsetof being used on
      # non-standard-layout types. offsetof is only specified for
      # standard-layout types, but its behaviour on non-standard-layout types is
      # implementation defined (rather than UB), and our supported compilers
      # have the expected reasonable behaviour.
      "-Wno-invalid-offsetof",
    ]
  }

  if (is_win) {
    cflags += [
      "/wd4245",  # Conversion with signed/unsigned mismatch.
      "/wd4267",  # Conversion with possible loss of data.
      "/wd4324",  # Padding structure due to alignment.
      "/wd4701",  # Potentially uninitialized local variable.
      "/wd4702",  # Unreachable code.
      "/wd4703",  # Potentially uninitialized local pointer variable.
      "/wd4709",  # Comma operator within array index expr (bugged).
      "/wd4714",  # Function marked forceinline not inlined.

      # MSVC assumes that control can get past an exhaustive switch and then
      # warns if there's no return there (see https://crbug.com/v8/7658)
      "/wd4715",  # Not all control paths return a value.

      "/wd4718",  # Recursive call has no side-effect.
      "/wd4723",  # https://crbug.com/v8/7771
      "/wd4724",  # https://crbug.com/v8/7771
      "/wd4800",  # Forcing value to bool.
    ]
  }

  if (!is_clang && is_win) {
    cflags += [
      "/wd4506",  # Benign "no definition for inline function"

      # Warnings permanently disabled:

      # C4091: 'typedef ': ignored on left of 'X' when no variable is
      #                    declared.
      # This happens in a number of Windows headers. Dumb.
      "/wd4091",

      # C4127: conditional expression is constant
      # This warning can in theory catch dead code and other problems, but
      # triggers in far too many desirable cases where the conditional
      # expression is either set by macros or corresponds some legitimate
      # compile-time constant expression (due to constant template args,
      # conditionals comparing the sizes of different types, etc.).  Some of
      # these can be worked around, but it's not worth it.
      "/wd4127",

      # C4251: 'identifier' : class 'type' needs to have dll-interface to be
      #        used by clients of class 'type2'
      # This is necessary for the shared library build.
      "/wd4251",

      # C4275:  non dll-interface class used as base for dll-interface class
      # This points out a potential (but rare) problem with referencing static
      # fields of a non-exported base, through the base's non-exported inline
      # functions, or directly. The warning is subtle enough that people just
      # suppressed it when they saw it, so it's not worth it.
      "/wd4275",

      # C4312 is a VS 2015 64-bit warning for integer to larger pointer.
      # TODO(brucedawson): fix warnings, crbug.com/554200
      "/wd4312",

      # C4324 warns when padding is added to fulfill alignas requirements,
      # but can trigger in benign cases that are difficult to individually
      # suppress.
      "/wd4324",

      # C4351: new behavior: elements of array 'array' will be default
      #        initialized
      # This is a silly "warning" that basically just alerts you that the
      # compiler is going to actually follow the language spec like it's
      # supposed to, instead of not following it like old buggy versions did.
      # There's absolutely no reason to turn this on.
      "/wd4351",

      # C4355: 'this': used in base member initializer list
      # It's commonly useful to pass |this| to objects in a class' initializer
      # list.  While this warning can catch real bugs, most of the time the
      # constructors in question don't attempt to call methods on the passed-in
      # pointer (until later), and annotating every legit usage of this is
      # simply more hassle than the warning is worth.
      "/wd4355",

      # C4503: 'identifier': decorated name length exceeded, name was
      #        truncated
      # This only means that some long error messages might have truncated
      # identifiers in the presence of lots of templates.  It has no effect on
      # program correctness and there's no real reason to waste time trying to
      # prevent it.
      "/wd4503",

      # Warning C4589 says: "Constructor of abstract class ignores
      # initializer for virtual base class." Disable this warning because it
      # is flaky in VS 2015 RTM. It triggers on compiler generated
      # copy-constructors in some cases.
      "/wd4589",

      # C4611: interaction between 'function' and C++ object destruction is
      #        non-portable
      # This warning is unavoidable when using e.g. setjmp/longjmp.  MSDN
      # suggests using exceptions instead of setjmp/longjmp for C++, but
      # Chromium code compiles without exception support.  We therefore have to
      # use setjmp/longjmp for e.g. JPEG decode error handling, which means we
      # have to turn off this warning (and be careful about how object
      # destruction happens in such cases).
      "/wd4611",

      # Warnings to evaluate and possibly fix/reenable later:

      "/wd4100",  # Unreferenced formal function parameter.
      "/wd4121",  # Alignment of a member was sensitive to packing.
      "/wd4244",  # Conversion: possible loss of data.
      "/wd4505",  # Unreferenced local function has been removed.
      "/wd4510",  # Default constructor could not be generated.
      "/wd4512",  # Assignment operator could not be generated.
      "/wd4610",  # Class can never be instantiated, constructor required.
      "/wd4838",  # Narrowing conversion. Doesn't seem to be very useful.
      "/wd4995",  # 'X': name was marked as #pragma deprecated
      "/wd4996",  # Deprecated function warning.

      # These are variable shadowing warnings that are new in VS2015. We
      # should work through these at some point -- they may be removed from
      # the RTM release in the /W4 set.
      "/wd4456",
      "/wd4457",
      "/wd4458",
      "/wd4459",

      # All of our compilers support the extensions below.
      "/wd4200",  # nonstandard extension used: zero-sized array in struct/union
      "/wd4201",  # nonstandard extension used: nameless struct/union
      "/wd4204",  # nonstandard extension used : non-constant aggregate
                  # initializer

      "/wd4221",  # nonstandard extension used : 'identifier' : cannot be
                  # initialized using address of automatic variable

      # http://crbug.com/588506 - Conversion suppressions waiting on Clang
      # -Wconversion.
      "/wd4245",  # 'conversion' : conversion from 'type1' to 'type2',
                  # signed/unsigned mismatch

      "/wd4267",  # 'var' : conversion from 'size_t' to 'type', possible loss of
                  # data

      "/wd4305",  # 'identifier' : truncation from 'type1' to 'type2'
      "/wd4389",  # 'operator' : signed/unsigned mismatch

      "/wd4702",  # unreachable code

      # http://crbug.com/848979 - MSVC is more conservative than Clang with
      # regards to variables initialized and consumed in different branches.
      "/wd4701",  # Potentially uninitialized local variable 'name' used
      "/wd4703",  # Potentially uninitialized local pointer variable 'name' used

      # http://crbug.com/848979 - Remaining Clang permitted warnings.
      "/wd4661",  # 'identifier' : no suitable definition provided for explicit
                  # template instantiation request

      "/wd4706",  # assignment within conditional expression
                  # MSVC is stricter and requires a boolean expression.

      "/wd4715",  # 'function' : not all control paths return a value'
                  # MSVC does not analyze switch (enum) for completeness.
    ]
  }

  if (!is_clang && !is_win) {
    cflags += [
      # Disable gcc warnings for optimizations based on the assumption that
      # signed overflow does not occur. Generates false positives (see
      # http://crbug.com/v8/6341).
      "-Wno-strict-overflow",

      # GCC assumes that control can get past an exhaustive switch and then
      # warns if there's no return there (see https://crbug.com/v8/7658).
      "-Wno-return-type",

      # Disable gcc warnings for using enum constant in boolean context.
      # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97266
      "-Wno-int-in-bool-context",

      # Disable gcc deprecation warnings, which are firing on implicit capture
      # of `this` in capture-by-value lambdas and preventing a build roll which
      # enables C++20 (see https://crbug.com/1374227).
      "-Wno-deprecated",

      # Fix build with older versions of GCC
      # Ported from v8 bazel: https://crrev.com/c/3368869
      "-Wno-stringop-overflow",

      # Fix a number of bogus errors with gcc12
      # TODO(miladfarca): re-evaluate for future gcc upgrades
      # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111499
      "-Wno-stringop-overread",

      # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104336
      "-Wno-restrict",

      # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523
      "-Wno-array-bounds",

      # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108517
      "-Wno-nonnull",
    ]
  }

  # Chromium uses a hand-picked subset of UBSan coverage. We want everything.
  if (is_ubsan) {
    cflags += [ "-fsanitize=undefined" ]
  }
}

config("strict_warnings") {
  cflags = []
  if (is_clang) {
    if (v8_current_cpu == "x64" || v8_current_cpu == "arm64" ||
        v8_current_cpu == "mips64el" || v8_current_cpu == "riscv64") {
      cflags += [ "-Wshorten-64-to-32" ]
    }
    cflags += [ "-Wmissing-field-initializers" ]
  }
}

# For code that is hot during mksnapshot. In fast-mksnapshot builds, we
# optimize some files even in debug builds to speed up mksnapshot times.
config("always_turbofanimize") {
  configs = [ ":internal_config" ]

  # TODO(crbug.com/621335) Rework this so that we don't have the confusion
  # between "optimize_speed" and "optimize_max".
  if (((is_posix && !is_android) || is_fuchsia) && !using_sanitizer) {
    configs += [ "//build/config/compiler:optimize_speed" ]
  } else {
    configs += [ "//build/config/compiler:optimize_max" ]
  }
}

###############################################################################
# Actions
#

# Only for Windows clang builds. Converts the embedded.S file produced by
# mksnapshot into an embedded.cc file with corresponding inline assembly.
template("asm_to_inline_asm") {
  name = target_name
  if (name == "default") {
    suffix = ""
  } else {
    suffix = "_$name"
  }

  action("asm_to_inline_asm_" + name) {
    visibility = [ ":*" ]  # Only targets in this file can depend on this.

    assert(emit_builtins_as_inline_asm)

    script = "tools/snapshot/asm_to_inline_asm.py"
    deps = [ ":run_mksnapshot_" + name ]
    sources = [ "$target_gen_dir/embedded${suffix}.S" ]
    outputs = [ "$target_gen_dir/embedded${suffix}.cc" ]
    args = invoker.args
    args += [
      rebase_path("$target_gen_dir/embedded${suffix}.S", root_build_dir),
      rebase_path("$target_gen_dir/embedded${suffix}.cc", root_build_dir),
    ]
  }
}

if (v8_postmortem_support) {
  action("postmortem-metadata") {
    # Only targets in this file can depend on this.
    visibility = [ ":*" ]

    script = "tools/gen-postmortem-metadata.py"

    # NOSORT
    inputs = [
      "$target_gen_dir/torque-generated/instance-types.h",
      "src/objects/allocation-site.h",
      "src/objects/allocation-site-inl.h",
      "src/objects/cell.h",
      "src/objects/cell-inl.h",
      "src/objects/dependent-code.h",
      "src/objects/dependent-code-inl.h",
      "src/objects/bytecode-array.h",
      "src/objects/bytecode-array-inl.h",
      "src/objects/abstract-code.h",
      "src/objects/abstract-code-inl.h",
      "src/objects/instruction-stream.h",
      "src/objects/instruction-stream-inl.h",
      "src/objects/code.h",
      "src/objects/code-inl.h",
      "src/objects/data-handler.h",
      "src/objects/data-handler-inl.h",
      "src/objects/deoptimization-data.h",
      "src/objects/deoptimization-data-inl.h",
      "src/objects/descriptor-array.h",
      "src/objects/descriptor-array-inl.h",
      "src/objects/feedback-cell.h",
      "src/objects/feedback-cell-inl.h",
      "src/objects/fixed-array.h",
      "src/objects/fixed-array-inl.h",
      "src/objects/heap-number.h",
      "src/objects/heap-number-inl.h",
      "src/objects/heap-object.h",
      "src/objects/heap-object-inl.h",
      "src/objects/instance-type.h",
      "src/objects/instance-type-checker.h",
      "src/objects/instance-type-inl.h",
      "src/objects/js-array-buffer.h",
      "src/objects/js-array-buffer-inl.h",
      "src/objects/js-array.h",
      "src/objects/js-array-inl.h",
      "src/objects/js-function-inl.h",
      "src/objects/js-function.cc",
      "src/objects/js-function.h",
      "src/objects/js-objects.cc",
      "src/objects/js-objects.h",
      "src/objects/js-objects-inl.h",
      "src/objects/js-promise.h",
      "src/objects/js-promise-inl.h",
      "src/objects/js-raw-json.cc",
      "src/objects/js-raw-json.h",
      "src/objects/js-raw-json-inl.h",
      "src/objects/js-regexp.cc",
      "src/objects/js-regexp.h",
      "src/objects/js-regexp-inl.h",
      "src/objects/js-regexp-string-iterator.h",
      "src/objects/js-regexp-string-iterator-inl.h",
      "src/objects/map.cc",
      "src/objects/map.h",
      "src/objects/map-inl.h",
      "src/objects/megadom-handler.h",
      "src/objects/megadom-handler-inl.h",
      "src/objects/name.h",
      "src/objects/name-inl.h",
      "src/objects/objects.h",
      "src/objects/objects-inl.h",
      "src/objects/oddball.h",
      "src/objects/oddball-inl.h",
      "src/objects/primitive-heap-object.h",
      "src/objects/primitive-heap-object-inl.h",
      "src/objects/scope-info.h",
      "src/objects/scope-info-inl.h",
      "src/objects/script.h",
      "src/objects/script-inl.h",
      "src/objects/shared-function-info.cc",
      "src/objects/shared-function-info.h",
      "src/objects/shared-function-info-inl.h",
      "src/objects/string.cc",
      "src/objects/string-comparator.cc",
      "src/objects/string-comparator.h",
      "src/objects/string.h",
      "src/objects/string-inl.h",
      "src/objects/struct.h",
      "src/objects/struct-inl.h",
      "src/objects/tagged.h",
    ]

    outputs = [ "$target_gen_dir/debug-support.cc" ]

    args = rebase_path(outputs, root_build_dir) +
           rebase_path(inputs, root_build_dir)

    deps = [ ":run_torque" ]
  }
}

torque_files = [
  "src/builtins/aggregate-error.tq",
  "src/builtins/array-at.tq",
  "src/builtins/array-concat.tq",
  "src/builtins/array-copywithin.tq",
  "src/builtins/array-every.tq",
  "src/builtins/array-filter.tq",
  "src/builtins/array-find.tq",
  "src/builtins/array-findindex.tq",
  "src/builtins/array-findlast.tq",
  "src/builtins/array-findlastindex.tq",
  "src/builtins/array-flat.tq",
  "src/builtins/array-foreach.tq",
  "src/builtins/array-from-async.tq",
  "src/builtins/array-from.tq",
  "src/builtins/array-isarray.tq",
  "src/builtins/array-join.tq",
  "src/builtins/array-lastindexof.tq",
  "src/builtins/array-map.tq",
  "src/builtins/array-of.tq",
  "src/builtins/array-reduce-right.tq",
  "src/builtins/array-reduce.tq",
  "src/builtins/array-reverse.tq",
  "src/builtins/array-shift.tq",
  "src/builtins/array-slice.tq",
  "src/builtins/array-some.tq",
  "src/builtins/array-splice.tq",
  "src/builtins/array-to-reversed.tq",
  "src/builtins/array-to-sorted.tq",
  "src/builtins/array-to-spliced.tq",
  "src/builtins/array-unshift.tq",
  "src/builtins/array-with.tq",
  "src/builtins/array.tq",
  "src/builtins/arraybuffer.tq",
  "src/builtins/base.tq",
  "src/builtins/boolean.tq",
  "src/builtins/builtins-bigint.tq",
  "src/builtins/builtins-string.tq",
  "src/builtins/cast.tq",
  "src/builtins/collections.tq",
  "src/builtins/constructor.tq",
  "src/builtins/conversion.tq",
  "src/builtins/convert.tq",
  "src/builtins/console.tq",
  "src/builtins/data-view.tq",
  "src/builtins/finalization-registry.tq",
  "src/builtins/frames.tq",
  "src/builtins/frame-arguments.tq",
  "src/builtins/function.tq",
  "src/builtins/growable-fixed-array.tq",
  "src/builtins/ic-callable.tq",
  "src/builtins/ic.tq",
  "src/builtins/internal-coverage.tq",
  "src/builtins/internal.tq",
  "src/builtins/iterator.tq",
  "src/builtins/iterator-from.tq",
  "src/builtins/iterator-helpers.tq",
  "src/builtins/map-groupby.tq",
  "src/builtins/math.tq",
  "src/builtins/number.tq",
  "src/builtins/object-fromentries.tq",
  "src/builtins/object-groupby.tq",
  "src/builtins/object.tq",
  "src/builtins/promise-abstract-operations.tq",
  "src/builtins/promise-all.tq",
  "src/builtins/promise-all-element-closure.tq",
  "src/builtins/promise-any.tq",
  "src/builtins/promise-constructor.tq",
  "src/builtins/promise-finally.tq",
  "src/builtins/promise-jobs.tq",
  "src/builtins/promise-misc.tq",
  "src/builtins/promise-race.tq",
  "src/builtins/promise-reaction-job.tq",
  "src/builtins/promise-resolve.tq",
  "src/builtins/promise-then.tq",
  "src/builtins/promise-withresolvers.tq",
  "src/builtins/proxy-constructor.tq",
  "src/builtins/proxy-delete-property.tq",
  "src/builtins/proxy-get-property.tq",
  "src/builtins/proxy-get-prototype-of.tq",
  "src/builtins/proxy-has-property.tq",
  "src/builtins/proxy-is-extensible.tq",
  "src/builtins/proxy-prevent-extensions.tq",
  "src/builtins/proxy-revocable.tq",
  "src/builtins/proxy-revoke.tq",
  "src/builtins/proxy-set-property.tq",
  "src/builtins/proxy-set-prototype-of.tq",
  "src/builtins/proxy.tq",
  "src/builtins/reflect.tq",
  "src/builtins/regexp-exec.tq",
  "src/builtins/regexp-match-all.tq",
  "src/builtins/regexp-match.tq",
  "src/builtins/regexp-replace.tq",
  "src/builtins/regexp-search.tq",
  "src/builtins/regexp-source.tq",
  "src/builtins/regexp-split.tq",
  "src/builtins/regexp-test.tq",
  "src/builtins/regexp.tq",
  "src/builtins/set-difference.tq",
  "src/builtins/set-intersection.tq",
  "src/builtins/set-is-disjoint-from.tq",
  "src/builtins/set-is-subset-of.tq",
  "src/builtins/set-is-superset-of.tq",
  "src/builtins/set-symmetric-difference.tq",
  "src/builtins/set-union.tq",
  "src/builtins/string-at.tq",
  "src/builtins/string-endswith.tq",
  "src/builtins/string-html.tq",
  "src/builtins/string-includes.tq",
  "src/builtins/string-indexof.tq",
  "src/builtins/string-iswellformed.tq",
  "src/builtins/string-iterator.tq",
  "src/builtins/string-match-search.tq",
  "src/builtins/string-pad.tq",
  "src/builtins/string-repeat.tq",
  "src/builtins/string-replaceall.tq",
  "src/builtins/string-slice.tq",
  "src/builtins/string-startswith.tq",
  "src/builtins/string-substr.tq",
  "src/builtins/string-substring.tq",
  "src/builtins/string-towellformed.tq",
  "src/builtins/string-trim.tq",
  "src/builtins/suppressed-error.tq",
  "src/builtins/symbol.tq",
  "src/builtins/torque-internal.tq",
  "src/builtins/typed-array-at.tq",
  "src/builtins/typed-array-createtypedarray.tq",
  "src/builtins/typed-array-every.tq",
  "src/builtins/typed-array-entries.tq",
  "src/builtins/typed-array-filter.tq",
  "src/builtins/typed-array-find.tq",
  "src/builtins/typed-array-findindex.tq",
  "src/builtins/typed-array-findlast.tq",
  "src/builtins/typed-array-findlastindex.tq",
  "src/builtins/typed-array-foreach.tq",
  "src/builtins/typed-array-from.tq",
  "src/builtins/typed-array-keys.tq",
  "src/builtins/typed-array-of.tq",
  "src/builtins/typed-array-reduce.tq",
  "src/builtins/typed-array-reduceright.tq",
  "src/builtins/typed-array-set.tq",
  "src/builtins/typed-array-slice.tq",
  "src/builtins/typed-array-some.tq",
  "src/builtins/typed-array-sort.tq",
  "src/builtins/typed-array-subarray.tq",
  "src/builtins/typed-array-to-reversed.tq",
  "src/builtins/typed-array-to-sorted.tq",
  "src/builtins/typed-array-values.tq",
  "src/builtins/typed-array-with.tq",
  "src/builtins/typed-array.tq",
  "src/builtins/weak-ref.tq",
  "src/ic/handler-configuration.tq",
  "src/objects/allocation-site.tq",
  "src/objects/api-callbacks.tq",
  "src/objects/arguments.tq",
  "src/objects/bigint.tq",
  "src/objects/call-site-info.tq",
  "src/objects/cell.tq",
  "src/objects/bytecode-array.tq",
  "src/objects/contexts.tq",
  "src/objects/data-handler.tq",
  "src/objects/debug-objects.tq",
  "src/objects/descriptor-array.tq",
  "src/objects/embedder-data-array.tq",
  "src/objects/feedback-cell.tq",
  "src/objects/feedback-vector.tq",
  "src/objects/fixed-array.tq",
  "src/objects/foreign.tq",
  "src/objects/free-space.tq",
  "src/objects/heap-number.tq",
  "src/objects/heap-object.tq",
  "src/objects/js-array-buffer.tq",
  "src/objects/js-array.tq",
  "src/objects/js-atomics-synchronization.tq",
  "src/objects/js-collection-iterator.tq",
  "src/objects/js-collection.tq",
  "src/objects/js-function.tq",
  "src/objects/js-generator.tq",
  "src/objects/js-iterator-helpers.tq",
  "src/objects/js-objects.tq",
  "src/objects/js-promise.tq",
  "src/objects/js-proxy.tq",
  "src/objects/js-raw-json.tq",
  "src/objects/js-regexp-string-iterator.tq",
  "src/objects/js-regexp.tq",
  "src/objects/js-shadow-realm.tq",
  "src/objects/js-shared-array.tq",
  "src/objects/js-struct.tq",
  "src/objects/js-temporal-objects.tq",
  "src/objects/js-weak-refs.tq",
  "src/objects/literal-objects.tq",
  "src/objects/map.tq",
  "src/objects/megadom-handler.tq",
  "src/objects/microtask.tq",
  "src/objects/module.tq",
  "src/objects/name.tq",
  "src/objects/oddball.tq",
  "src/objects/hole.tq",
  "src/objects/trusted-object.tq",
  "src/objects/ordered-hash-table.tq",
  "src/objects/primitive-heap-object.tq",
  "src/objects/promise.tq",
  "src/objects/property-array.tq",
  "src/objects/property-cell.tq",
  "src/objects/property-descriptor-object.tq",
  "src/objects/prototype-info.tq",
  "src/objects/regexp-match-info.tq",
  "src/objects/scope-info.tq",
  "src/objects/script.tq",
  "src/objects/shared-function-info.tq",
  "src/objects/source-text-module.tq",
  "src/objects/string.tq",
  "src/objects/struct.tq",
  "src/objects/swiss-hash-table-helpers.tq",
  "src/objects/swiss-name-dictionary.tq",
  "src/objects/synthetic-module.tq",
  "src/objects/template-objects.tq",
  "src/objects/templates.tq",
  "src/objects/torque-defined-classes.tq",
  "src/objects/turbofan-types.tq",
  "src/objects/turboshaft-types.tq",
  "test/torque/test-torque.tq",
  "third_party/v8/builtins/array-sort.tq",
]

if (v8_enable_i18n_support) {
  torque_files += [
    "src/objects/intl-objects.tq",
    "src/objects/js-break-iterator.tq",
    "src/objects/js-collator.tq",
    "src/objects/js-date-time-format.tq",
    "src/objects/js-display-names.tq",
    "src/objects/js-duration-format.tq",
    "src/objects/js-list-format.tq",
    "src/objects/js-locale.tq",
    "src/objects/js-number-format.tq",
    "src/objects/js-plural-rules.tq",
    "src/objects/js-relative-time-format.tq",
    "src/objects/js-segment-iterator.tq",
    "src/objects/js-segmenter.tq",
    "src/objects/js-segments.tq",
  ]
}

if (v8_enable_webassembly) {
  torque_files += [
    "src/builtins/js-to-js.tq",
    "src/builtins/js-to-wasm.tq",
    "src/builtins/wasm.tq",
    "src/builtins/wasm-strings.tq",
    "src/builtins/wasm-to-js.tq",
    "src/debug/debug-wasm-objects.tq",
    "src/wasm/wasm-objects.tq",
  ]
}

# Template for running torque
# When building with v8_verify_torque_generation_invariance=true we need
# to be able to run torque for both 32 and 64 bits in the same build
template("run_torque") {
  if (target_name == "") {
    suffix = ""
  } else {
    suffix = "_$target_name"
  }

  toolchain = invoker.toolchain

  action("run_torque" + suffix) {
    visibility = [
      ":*",
      "test/cctest/:*",
      "tools/debug_helper/:*",
      "tools/gcmole/:*",
    ]

    deps = [ ":torque($toolchain)" ]

    script = "tools/run.py"

    sources = torque_files

    destination_folder = "$target_gen_dir/torque-generated$suffix"

    outputs = [
      "$destination_folder/bit-fields.h",
      "$destination_folder/builtin-definitions.h",
      "$destination_folder/class-debug-readers.cc",
      "$destination_folder/class-debug-readers.h",
      "$destination_folder/class-forward-declarations.h",
      "$destination_folder/class-verifiers.cc",
      "$destination_folder/class-verifiers.h",
      "$destination_folder/csa-types.h",
      "$destination_folder/debug-macros.cc",
      "$destination_folder/debug-macros.h",
      "$destination_folder/enum-verifiers.cc",
      "$destination_folder/exported-macros-assembler.cc",
      "$destination_folder/exported-macros-assembler.h",
      "$destination_folder/factory.cc",
      "$destination_folder/factory.inc",
      "$destination_folder/instance-types.h",
      "$destination_folder/interface-descriptors.inc",
      "$destination_folder/objects-body-descriptors-inl.inc",
      "$destination_folder/objects-printer.cc",
      "$destination_folder/visitor-lists.h",
    ]

    foreach(file, torque_files) {
      filetq = string_replace(file, ".tq", "-tq")
      outputs += [
        "$destination_folder/$filetq-csa.cc",
        "$destination_folder/$filetq-csa.h",
        "$destination_folder/$filetq-inl.inc",
        "$destination_folder/$filetq.cc",
        "$destination_folder/$filetq.inc",
      ]
    }

    args = [
      "./" + rebase_path(
              get_label_info(":torque($toolchain)", "root_out_dir") + "/torque",
              root_build_dir),
      "-o",
      rebase_path("$destination_folder", root_build_dir),
      "-v8-root",
      rebase_path(".", root_build_dir),
    ]
    if (v8_annotate_torque_ir) {
      args += [ "-annotate-ir" ]
    }
    if (defined(invoker.args)) {
      args += invoker.args
    }
    args += torque_files
  }
}

# Default run_torque action
run_torque("") {
  toolchain = v8_generator_toolchain
}

if (v8_verify_torque_generation_invariance) {
  run_torque("x86") {
    toolchain = "//build/toolchain/linux:clang_x86"
  }

  run_torque("x64") {
    args = [ "-m32" ]
    toolchain = "//build/toolchain/linux:clang_x64"
  }

  action("compare_torque_runs") {
    deps = [
      ":run_torque_x64",
      ":run_torque_x86",
    ]
    report_file = "$target_gen_dir/torque_comparison_results.txt"
    script = "tools/compare_torque_output.py"
    args = [
      rebase_path("$target_gen_dir/torque-generated_x64", root_build_dir),
      rebase_path("$target_gen_dir/torque-generated_x86", root_build_dir),
      rebase_path(report_file, root_build_dir),
    ]
    outputs = [ report_file ]
  }
}

group("v8_maybe_icu") {
  if (v8_enable_i18n_support) {
    public_deps = [ v8_icu_path ]
  }
}

group("v8_abseil") {
  public_deps = [ "//third_party/abseil-cpp:absl" ]

  public_configs = [
    "//third_party/abseil-cpp:absl_define_config",
    "//third_party/abseil-cpp:absl_include_config",
  ]
}

v8_header_set("torque_runtime_support") {
  visibility = [ ":*" ]

  sources = [ "src/torque/runtime-support.h" ]

  configs = [ ":internal_config" ]
}

v8_source_set("torque_generated_initializers") {
  visibility = [ ":*" ]  # Only targets in this file can depend on this.

  deps = [
    ":generate_bytecode_builtins_list",
    ":run_torque",
    ":v8_base_without_compiler",
    ":v8_tracing",
  ]

  public_deps = [
    ":torque_runtime_support",
    ":v8_abseil",
    ":v8_maybe_icu",
  ]

  sources = [
    "$target_gen_dir/torque-generated/csa-types.h",
    "$target_gen_dir/torque-generated/enum-verifiers.cc",
    "$target_gen_dir/torque-generated/exported-macros-assembler.cc",
    "$target_gen_dir/torque-generated/exported-macros-assembler.h",
  ]
  foreach(file, torque_files) {
    filetq = string_replace(file, ".tq", "-tq")
    sources += [
      "$target_gen_dir/torque-generated/$filetq-csa.cc",
      "$target_gen_dir/torque-generated/$filetq-csa.h",
    ]
  }

  configs = [ ":internal_config" ]

  if (v8_symbol_level > 1) {
    # Symbols cause huge compile time on some bigger torque files, see
    # https://crbug.com/1472715. Thus remove any symbol configs added in v8.gni
    # and instead add the "minimal_symbols" config.
    v8_add_configs -=
        filter_include(v8_add_configs, [ "//build/config/compiler:*symbols" ])
    if (v8_symbol_level == symbol_level) {
      v8_remove_configs += [ "//build/config/compiler:default_symbols" ]
    }
    configs += [ "//build/config/compiler:minimal_symbols" ]
  }
}

v8_source_set("torque_generated_definitions") {
  visibility = [ ":*" ]  # Only targets in this file can depend on this.

  deps = [
    ":generate_bytecode_builtins_list",
    ":run_torque",
    ":v8_internal_headers",
    ":v8_libbase",
    ":v8_tracing",
  ]

  public_deps = [
    ":v8_abseil",
    ":v8_maybe_icu",
  ]

  sources = [
    "$target_gen_dir/torque-generated/class-forward-declarations.h",
    "$target_gen_dir/torque-generated/class-verifiers.cc",
    "$target_gen_dir/torque-generated/class-verifiers.h",
    "$target_gen_dir/torque-generated/factory.cc",
    "$target_gen_dir/torque-generated/objects-printer.cc",
  ]
  foreach(file, torque_files) {
    filetq = string_replace(file, ".tq", "-tq")
    sources += [
      "$target_gen_dir/torque-generated/$filetq-inl.inc",
      "$target_gen_dir/torque-generated/$filetq.cc",
      "$target_gen_dir/torque-generated/$filetq.inc",
    ]
  }

  configs = [ ":internal_config" ]
}

action("generate_bytecode_builtins_list") {
  script = "tools/run.py"
  outputs = [ "$target_gen_dir/builtins-generated/bytecodes-builtins-list.h" ]
  deps = [ ":bytecode_builtins_list_generator($v8_generator_toolchain)" ]
  args = [
    "./" + rebase_path(
            get_label_info(
                    ":bytecode_builtins_list_generator($v8_generator_toolchain)",
                    "root_out_dir") + "/bytecode_builtins_list_generator",
            root_build_dir),
    rebase_path("$target_gen_dir/builtins-generated/bytecodes-builtins-list.h",
                root_build_dir),
  ]
}

# Template to generate different V8 snapshots based on different runtime flags.
# Can be invoked with run_mksnapshot(<name>). The target will resolve to
# run_mksnapshot_<name>. If <name> is "default", no file suffixes will be used.
# Otherwise files are suffixed, e.g. embedded_<name>.S and
# snapshot_blob_<name>.bin.
#
# The template exposes the variables:
#   args: additional flags for mksnapshots
#   embedded_suffix: a camel case suffix for method names in the embedded
#       snapshot.
template("run_mksnapshot") {
  name = target_name
  if (name == "default") {
    suffix = ""
  } else {
    suffix = "_$name"
  }
  action("run_mksnapshot_" + name) {
    deps = [ ":mksnapshot($v8_snapshot_toolchain)" ]

    script = "tools/run.py"

    sources = []

    outputs = []

    data = []

    args = [
      "./" + rebase_path(get_label_info(":mksnapshot($v8_snapshot_toolchain)",
                                        "root_out_dir") + "/mksnapshot",
                         root_build_dir),
      "--turbo_instruction_scheduling",
      "--stress-turbo-late-spilling",

      # In cross builds, the snapshot may be generated for both the host and
      # target toolchains.  The same host binary is used to generate both, so
      # mksnapshot needs to know which target OS to use at runtime.  It's weird,
      # but the target OS is really |current_os|.
      "--target_os=$current_os",
      "--target_arch=$current_cpu",

      "--embedded_src",
      rebase_path("$target_gen_dir/embedded${suffix}.S", root_build_dir),
    ]

    if (v8_log_builtins_block_count_input != "") {
      args += [
        "--trace-turbo",

        "--turbo-log-builtins-count-input",
        v8_log_builtins_block_count_input,
      ]
    }

    if (v8_enable_builtins_profiling) {
      args += [ "--turbo-profiling" ]
    }
    if (v8_enable_builtins_profiling_verbose) {
      args += [ "--turbo-profiling-verbose" ]
    }
    if (v8_builtins_profiling_log_file != "") {
      sources += [ v8_builtins_profiling_log_file ]
      args += [
        "--turbo-profiling-input",
        rebase_path(v8_builtins_profiling_log_file, root_build_dir),

        # Replace this with --warn-about-builtin-profile-data to see the full
        # list of builtins with incompatible profiles.
        "--abort-on-bad-builtin-profile-data",
      ]

      if (!v8_enable_builtins_profiling && v8_enable_builtins_reordering) {
        args += [ "--reorder-builtins" ]
      }
    }

    # This is needed to distinguish between generating code for the simulator
    # and cross-compiling. The latter may need to run code on the host with the
    # simulator but cannot use simulator-specific instructions.
    if (target_is_simulator) {
      args += [ "--target_is_simulator" ]
    }

    args += invoker.args

    outputs += [ "$target_gen_dir/embedded${suffix}.S" ]
    if (invoker.embedded_variant != "") {
      args += [
        "--embedded_variant",
        invoker.embedded_variant,
      ]
    }

    if (v8_random_seed != "0") {
      args += [
        "--random-seed",
        v8_random_seed,
      ]
    }

    if (v8_os_page_size != "0") {
      args += [
        "--v8_os_page_size",
        v8_os_page_size,
      ]
    }

    if (v8_use_external_startup_data) {
      outputs += [ "$root_out_dir/snapshot_blob${suffix}.bin" ]
      data += [ "$root_out_dir/snapshot_blob${suffix}.bin" ]
      args += [
        "--startup_blob",
        rebase_path("$root_out_dir/snapshot_blob${suffix}.bin", root_build_dir),
      ]
    } else {
      outputs += [ "$target_gen_dir/snapshot${suffix}.cc" ]
      args += [
        "--startup_src",
        rebase_path("$target_gen_dir/snapshot${suffix}.cc", root_build_dir),
      ]
    }

    if (v8_embed_script != "") {
      sources += [ v8_embed_script ]
      args += [ rebase_path(v8_embed_script, root_build_dir) ]
    }

    if (v8_enable_snapshot_code_comments) {
      args += [ "--code-comments" ]
    }

    if (v8_enable_snapshot_native_code_counters) {
      args += [ "--native-code-counters" ]
    } else {
      # --native-code-counters is the default in debug mode so make sure we can
      # unset it.
      args += [ "--no-native-code-counters" ]
    }

    if (v8_enable_fast_mksnapshot) {
      args += [ "--no-turbo-verify-allocation" ]

      if (v8_current_cpu == "x86" || v8_current_cpu == "x64") {
        args += [ "--no-turbo-rewrite-far-jumps" ]
      }

      if (v8_enable_debugging_features && v8_enable_slow_dchecks) {
        # mksnapshot only accepts this flag if ENABLE_SLOW_DCHECKS is defined.
        args += [ "--no-enable-slow-asserts" ]
      }
    }

    if (v8_enable_verify_heap) {
      args += [ "--verify-heap" ]
    }
  }
}

run_mksnapshot("default") {
  args = []
  embedded_variant = "Default"
}
if (emit_builtins_as_inline_asm) {
  asm_to_inline_asm("default") {
    args = []
  }
}

if (v8_verify_deterministic_mksnapshot) {
  runs = [
    "run_0",
    "run_1",
    "run_2",
    "run_3",
    "run_4",
    "run_5",
    "run_6",
  ]

  foreach(i, runs) {
    run_mksnapshot(i) {
      args = []
      embedded_variant = "Default"
    }
  }

  action("verify_deterministic_mksnapshot") {
    deps = []
    foreach(i, runs) {
      deps += [ ":run_mksnapshot_$i" ]
    }
    report_file = "$target_gen_dir/mksnapshot_comparison.txt"
    script = "tools/snapshot/compare_mksnapshot_output.py"
    args = [
      rebase_path("$report_file", root_build_dir),
      rebase_path("$target_gen_dir", root_build_dir),
      rebase_path("$root_out_dir", root_build_dir),
      "7",  # Length of the 'runs' list.
    ]
    outputs = [ report_file ]
  }
}

if (v8_verify_builtins_compatibility) {
  # This specifies a separate mksnapshot target for each of:
  # x86, x64, arm, arm64.
  hashes = "builtins_hashes_$v8_current_cpu"
  run_mksnapshot("dump_$v8_current_cpu") {
    args = [
      "--dump-builtins-hashes-to-file",
      hashes,
    ]
    embedded_variant = "Default"
  }

  # This template defines a comparison action for the architecture the pgo
  # profile is made for (e.g. x64) and the architecture the profile is used
  # for (e.g. arm64 with toolchain x64_v8_arm64).
  template("verify_builtins_hashes") {
    forward_variables_from(invoker,
                           [
                             "profile_arch",
                             "target_arch",
                           ])
    profile_toolchain = "//build/toolchain/linux:clang_${profile_arch}"
    target_toolchain =
        "//build/toolchain/linux:clang_${profile_arch}_v8_${target_arch}"
    action("compare_builtins_$target_name") {
      deps = [
        ":run_mksnapshot_dump_${profile_arch}($profile_toolchain)",
        ":run_mksnapshot_dump_${target_arch}($target_toolchain)",
      ]
      report_file = "$root_build_dir/builtins_comparison_$target_name"
      script = "tools/builtins-pgo/assert_builtins_hashes.py"
      args = [
        "builtins_hashes_${profile_arch}",
        "builtins_hashes_${target_arch}",
        rebase_path(report_file, root_build_dir),
      ]
      outputs = [ report_file ]
    }
  }

  verify_builtins_hashes("x86_arm") {
    profile_arch = "x86"
    target_arch = "arm"
  }

  verify_builtins_hashes("x64_arm64") {
    profile_arch = "x64"
    target_arch = "arm64"
  }

  group("verify_all_builtins_hashes") {
    deps = [
      ":compare_builtins_x64_arm64",
      ":compare_builtins_x86_arm",
    ]
  }
}

action("v8_dump_build_config") {
  script = "tools/testrunner/utils/dump_build_config.py"
  outputs = [ "$root_out_dir/v8_build_config.json" ]
  is_DEBUG_defined = v8_enable_debugging_features || dcheck_always_on
  is_full_debug = v8_enable_debugging_features && !v8_optimized_debug

  arch = v8_target_cpu
  if (v8_target_cpu == "x86") {
    arch = "ia32"
  }

  mips_arch_variant_var = ""
  mips_use_msa_var = false
  if (arch == "mips64" || arch == "mips64el") {
    mips_arch_variant_var = mips_arch_variant
    mips_use_msa_var = mips_use_msa
  }

  js_shared_memory =
      v8_enable_shared_ro_heap && (!v8_enable_pointer_compression ||
                                   v8_enable_pointer_compression_shared_cage) &&
      !v8_disable_write_barriers
  simd_mips = mips_arch_variant_var == "r6" && mips_use_msa
  simulator_run = target_cpu != v8_target_cpu
  use_sanitizer = is_asan || is_cfi || is_msan || is_tsan || is_ubsan

  # This lists all build-time switches consumed by the test framework. All
  # switches can be used automatically in the status files as is - no
  # further files need to be modified.
  #
  # Naming conventions: Keep switch names short and remove unnecessary
  # qualifiers. Drop v8_enable_, v8_, is_ where possible.
  # Keep only qualifiers that disambiguate the switches from other things.
  # Examples: has_turbofan disambiguates from the turbofan runtime variant,
  # is_android disambiguates from the android keyword in status files,
  # v8_cfi disambiguates from the global cfi flag.
  args = [
    rebase_path("$root_out_dir/v8_build_config.json", root_build_dir),
    "arch=\"$arch\"",
    "asan=$is_asan",
    "atomic_object_field_writes=$v8_enable_atomic_object_field_writes",
    "cet_shadow_stack=$v8_enable_cet_shadow_stack",
    "cfi=$is_cfi",
    "clang=$is_clang",
    "clang_coverage=$use_clang_coverage",
    "code_comments=$v8_code_comments",
    "component_build=$is_component_build",
    "concurrent_marking=$v8_enable_concurrent_marking",
    "conservative_stack_scanning=$v8_enable_conservative_stack_scanning",
    "current_cpu=\"$current_cpu\"",
    "dcheck_always_on=$dcheck_always_on",
    "debug_code=$v8_enable_debug_code",
    "DEBUG_defined=$is_DEBUG_defined",
    "debugging_features=$v8_enable_debugging_features",
    "dict_property_const_tracking=$v8_dict_property_const_tracking",
    "direct_handle=$v8_enable_direct_handle",
    "direct_local=$v8_enable_direct_local",
    "disassembler=$v8_enable_disassembler",
    "full_debug=$is_full_debug",
    "gdbjit=$v8_enable_gdbjit",
    "has_jitless=$v8_jitless",
    "has_maglev=$v8_enable_maglev",
    "has_turbofan=$v8_enable_turbofan",
    "has_webassembly=$v8_enable_webassembly",
    "i18n=$v8_enable_i18n_support",
    "is_android=$is_android",
    "is_ios=$is_ios",
    "js_shared_memory=$js_shared_memory",
    "lite_mode=$v8_enable_lite_mode",
    "local_off_stack_check=$v8_enable_local_off_stack_check",
    "mips_arch_variant=\"$mips_arch_variant_var\"",
    "mips_use_msa=$mips_use_msa_var",
    "msan=$is_msan",
    "official_build=$is_official_build",
    "pointer_compression=$v8_enable_pointer_compression",
    "pointer_compression_shared_cage=$v8_enable_pointer_compression_shared_cage",
    "runtime_call_stats=$v8_enable_runtime_call_stats",
    "sandbox=$v8_enable_sandbox",
    "shared_ro_heap=$v8_enable_shared_ro_heap",
    "simd_mips=$simd_mips",
    "simulator_run=$simulator_run",
    "single_generation=$v8_enable_single_generation",
    "slow_dchecks=$v8_enable_slow_dchecks",
    "target_cpu=\"$target_cpu\"",
    "third_party_heap=$v8_enable_third_party_heap",
    "tsan=$is_tsan",
    "ubsan=$is_ubsan",
    "use_sanitizer=$use_sanitizer",
    "v8_cfi=$v8_control_flow_integrity",
    "v8_current_cpu=\"$v8_current_cpu\"",
    "v8_target_cpu=\"$v8_target_cpu\"",
    "verify_csa=$v8_enable_verify_csa",
    "verify_heap=$v8_enable_verify_heap",
    "verify_predictable=$v8_enable_verify_predictable",
  ]
}

# Generate a json file containing essential V8 build flags.
# This json file is consumed by embedders like Node.js and Electron to provide
# information for building third party modules. There is currently no exact
# rules on which build flags should be outputed in the json file, but anything
# affecting the |external_v8_defines| list must be listed here and added to
# the common.gypi file in Node.js repo.
generated_file("v8_generate_features_json") {
  outputs = [ "$root_out_dir/v8_features.json" ]
  output_conversion = "json"
  contents = {
    v8_deprecation_warnings = v8_deprecation_warnings
    v8_enable_31bit_smis_on_64bit_arch = v8_enable_31bit_smis_on_64bit_arch
    v8_enable_conservative_stack_scanning =
        v8_enable_conservative_stack_scanning
    v8_enable_direct_local = v8_enable_direct_local
    v8_enable_extensible_ro_snapshot = v8_enable_extensible_ro_snapshot
    v8_enable_gdbjit = v8_enable_gdbjit
    v8_enable_hugepage = v8_enable_hugepage
    v8_enable_i18n_support = v8_enable_i18n_support
    v8_enable_javascript_promise_hooks = v8_enable_javascript_promise_hooks
    v8_enable_lite_mode = v8_enable_lite_mode
    v8_enable_map_packing = v8_enable_map_packing
    v8_enable_object_print = v8_enable_object_print
    v8_enable_pointer_compression = v8_enable_pointer_compression
    v8_enable_pointer_compression_shared_cage =
        v8_enable_pointer_compression_shared_cage
    v8_enable_sandbox = v8_enable_sandbox
    v8_enable_shared_ro_heap = v8_enable_shared_ro_heap
    v8_enable_short_builtin_calls = v8_enable_short_builtin_calls
    v8_enable_v8_checks = v8_enable_v8_checks
    v8_enable_webassembly = v8_enable_webassembly
    v8_enable_zone_compression = v8_enable_zone_compression
    v8_imminent_deprecation_warnings = v8_imminent_deprecation_warnings
    v8_optimized_debug = v8_optimized_debug
    v8_random_seed = v8_random_seed
    v8_use_perfetto = v8_use_perfetto
    v8_use_siphash = v8_use_siphash
  }
}

###############################################################################
# Source Sets (aka static libraries)
#

v8_source_set("v8_snapshot") {
  # Let external targets depend on v8_snapshot.
  if (v8_use_external_startup_data) {
    visibility = [ ":*" ]  # Targets in this file can depend on this.
  }

  deps = [
    ":v8_internal_headers",
    ":v8_libbase",
    ":v8_tracing",
  ]
  public_deps = [
    # This should be public so downstream targets can declare the snapshot
    # output file as their inputs.
    ":run_mksnapshot_default",
  ]

  # Do not publicize any header to remove build dependency.
  public = []

  sources = [ "src/init/setup-isolate-deserialize.cc" ]
  if (v8_control_flow_integrity) {
    sources += [ "src/deoptimizer/deoptimizer-cfi-builtins.cc" ]
  }
  if (emit_builtins_as_inline_asm) {
    deps += [ ":asm_to_inline_asm_default" ]
    sources += [ "$target_gen_dir/embedded.cc" ]
  } else {
    sources += [ "$target_gen_dir/embedded.S" ]
  }

  configs = [ ":internal_config" ]

  if (v8_use_external_startup_data) {
    deps += [ ":v8_base" ]

    sources += [ "src/snapshot/snapshot-external.cc" ]
  } else {
    public_deps += [
      ":v8_abseil",
      ":v8_maybe_icu",
    ]

    sources += [ "$target_gen_dir/snapshot.cc" ]
  }
}

v8_source_set("v8_initializers") {
  visibility = [
    ":*",
    "test/cctest:*",
  ]

  allow_circular_includes_from = [ ":torque_generated_initializers" ]

  deps = [
    ":torque_generated_initializers",
    ":v8_base_without_compiler",
    ":v8_shared_internal_headers",
    ":v8_tracing",
  ]

  sources = [
    ### gcmole(all) ###
    "src/builtins/builtins-array-gen.cc",
    "src/builtins/builtins-array-gen.h",
    "src/builtins/builtins-async-function-gen.cc",
    "src/builtins/builtins-async-gen.cc",
    "src/builtins/builtins-async-gen.h",
    "src/builtins/builtins-async-generator-gen.cc",
    "src/builtins/builtins-async-iterator-gen.cc",
    "src/builtins/builtins-bigint-gen.cc",
    "src/builtins/builtins-bigint-gen.h",
    "src/builtins/builtins-call-gen.cc",
    "src/builtins/builtins-call-gen.h",
    "src/builtins/builtins-collections-gen.cc",
    "src/builtins/builtins-collections-gen.h",
    "src/builtins/builtins-constructor-gen.cc",
    "src/builtins/builtins-constructor-gen.h",
    "src/builtins/builtins-constructor.h",
    "src/builtins/builtins-conversion-gen.cc",
    "src/builtins/builtins-data-view-gen.h",
    "src/builtins/builtins-date-gen.cc",
    "src/builtins/builtins-generator-gen.cc",
    "src/builtins/builtins-global-gen.cc",
    "src/builtins/builtins-handler-gen.cc",
    "src/builtins/builtins-ic-gen.cc",
    "src/builtins/builtins-internal-gen.cc",
    "src/builtins/builtins-interpreter-gen.cc",
    "src/builtins/builtins-intl-gen.cc",
    "src/builtins/builtins-iterator-gen.cc",
    "src/builtins/builtins-iterator-gen.h",
    "src/builtins/builtins-lazy-gen.cc",
    "src/builtins/builtins-lazy-gen.h",
    "src/builtins/builtins-microtask-queue-gen.cc",
    "src/builtins/builtins-number-gen.cc",
    "src/builtins/builtins-object-gen.cc",
    "src/builtins/builtins-object-gen.h",
    "src/builtins/builtins-promise-gen.cc",
    "src/builtins/builtins-promise-gen.h",
    "src/builtins/builtins-proxy-gen.cc",
    "src/builtins/builtins-proxy-gen.h",
    "src/builtins/builtins-regexp-gen.cc",
    "src/builtins/builtins-regexp-gen.h",
    "src/builtins/builtins-shadow-realm-gen.cc",
    "src/builtins/builtins-sharedarraybuffer-gen.cc",
    "src/builtins/builtins-string-gen.cc",
    "src/builtins/builtins-string-gen.h",
    "src/builtins/builtins-temporal-gen.cc",
    "src/builtins/builtins-typed-array-gen.cc",
    "src/builtins/builtins-typed-array-gen.h",
    "src/builtins/builtins-utils-gen.h",
    "src/builtins/growable-fixed-array-gen.cc",
    "src/builtins/growable-fixed-array-gen.h",
    "src/builtins/profile-data-reader.cc",
    "src/builtins/profile-data-reader.h",
    "src/builtins/setup-builtins-internal.cc",
    "src/builtins/torque-csa-header-includes.h",
    "src/codegen/code-stub-assembler-inl.h",
    "src/codegen/code-stub-assembler.cc",
    "src/codegen/code-stub-assembler.h",
    "src/heap/setup-heap-internal.cc",
    "src/ic/accessor-assembler.cc",
    "src/ic/accessor-assembler.h",
    "src/ic/binary-op-assembler.cc",
    "src/ic/binary-op-assembler.h",
    "src/ic/keyed-store-generic.cc",
    "src/ic/keyed-store-generic.h",
    "src/ic/unary-op-assembler.cc",
    "src/ic/unary-op-assembler.h",
    "src/interpreter/interpreter-assembler.cc",
    "src/interpreter/interpreter-assembler.h",
    "src/interpreter/interpreter-generator.cc",
    "src/interpreter/interpreter-generator.h",
    "src/interpreter/interpreter-intrinsics-generator.cc",
    "src/interpreter/interpreter-intrinsics-generator.h",
    "src/numbers/integer-literal-inl.h",
    "src/numbers/integer-literal.h",
  ]

  if (v8_enable_webassembly) {
    sources += [
      "src/builtins/builtins-wasm-gen.cc",
      "src/builtins/builtins-wasm-gen.h",
    ]
  }

  if (v8_current_cpu == "x86") {
    sources += [
      ### gcmole(ia32) ###
      "src/builtins/ia32/builtins-ia32.cc",
    ]
  } else if (v8_current_cpu == "x64") {
    sources += [
      ### gcmole(x64) ###
      "src/builtins/x64/builtins-x64.cc",
    ]
  } else if (v8_current_cpu == "arm") {
    sources += [
      ### gcmole(arm) ###
      "src/builtins/arm/builtins-arm.cc",
    ]
  } else if (v8_current_cpu == "arm64") {
    sources += [
      ### gcmole(arm64) ###
      "src/builtins/arm64/builtins-arm64.cc",
    ]
  } else if (v8_current_cpu == "mips64" || v8_current_cpu == "mips64el") {
    sources += [
      ### gcmole(mips64el) ###
      "src/builtins/mips64/builtins-mips64.cc",
    ]
  } else if (v8_current_cpu == "loong64") {
    sources += [
      ### gcmole(loong64) ###
      "src/builtins/loong64/builtins-loong64.cc",
    ]
  } else if (v8_current_cpu == "ppc") {
    sources += [
      ### gcmole(ppc) ###
      "src/builtins/ppc/builtins-ppc.cc",
    ]
  } else if (v8_current_cpu == "ppc64") {
    sources += [
      ### gcmole(ppc64) ###
      "src/builtins/ppc/builtins-ppc.cc",
    ]
  } else if (v8_current_cpu == "s390" || v8_current_cpu == "s390x") {
    sources += [
      ### gcmole(s390) ###
      "src/builtins/s390/builtins-s390.cc",
    ]
  } else if (v8_current_cpu == "riscv64") {
    sources += [
      ### gcmole(riscv64) ###
      "src/builtins/riscv/builtins-riscv.cc",
    ]
  } else if (v8_current_cpu == "riscv32") {
    sources += [
      ### gcmole(riscv32) ###
      "src/builtins/riscv/builtins-riscv.cc",
    ]
  }

  if (!v8_enable_i18n_support) {
    sources -= [ "src/builtins/builtins-intl-gen.cc" ]
  }

  configs = [ ":internal_config" ]
}

v8_source_set("v8_init") {
  visibility = [ ":*" ]  # Only targets in this file can depend on this.

  deps = [
    ":v8_base_without_compiler",
    ":v8_initializers",
    ":v8_tracing",
  ]

  sources = [
    ### gcmole(all) ###
    "src/init/setup-isolate-full.cc",
  ]

  public_deps = [
    ":v8_abseil",
    ":v8_maybe_icu",
  ]

  configs = [ ":internal_config" ]
}

# This is split out to be a non-code containing target that the Chromium browser
# DLL can depend upon to get only a version string.
v8_header_set("v8_version") {
  configs = [ ":internal_config" ]

  sources = [
    "include/v8-value-serializer-version.h",
    "include/v8-version-string.h",
    "include/v8-version.h",
  ]
}

v8_header_set("v8_config_headers") {
  configs = [ ":internal_config" ]

  sources = [
    "include/v8-platform.h",
    "include/v8-source-location.h",
    "include/v8config.h",
  ]

  deps = []

  if (v8_generate_external_defines_header) {
    sources += [ "$target_gen_dir/include/v8-gn.h" ]
    deps += [ ":gen_v8_gn" ]
  }
}

# This is split out to be a non-code containing target that the Chromium browser
# can depend upon to get basic v8 types.
v8_header_set("v8_headers") {
  configs = [ ":internal_config" ]
  public_configs = [ ":headers_config" ]

  sources = [
    "include/v8-array-buffer.h",
    "include/v8-callbacks.h",
    "include/v8-container.h",
    "include/v8-context.h",
    "include/v8-cppgc.h",
    "include/v8-data.h",
    "include/v8-date.h",
    "include/v8-debug.h",
    "include/v8-embedder-heap.h",
    "include/v8-embedder-state-scope.h",
    "include/v8-exception.h",
    "include/v8-extension.h",
    "include/v8-external.h",
    "include/v8-fast-api-calls.h",
    "include/v8-forward.h",
    "include/v8-function-callback.h",
    "include/v8-function.h",
    "include/v8-handle-base.h",
    "include/v8-initialization.h",
    "include/v8-internal.h",
    "include/v8-isolate.h",
    "include/v8-json.h",
    "include/v8-local-handle.h",
    "include/v8-locker.h",
    "include/v8-maybe.h",
    "include/v8-memory-span.h",
    "include/v8-message.h",
    "include/v8-microtask-queue.h",
    "include/v8-microtask.h",
    "include/v8-object.h",
    "include/v8-persistent-handle.h",
    "include/v8-primitive-object.h",
    "include/v8-primitive.h",
    "include/v8-profiler.h",
    "include/v8-promise.h",
    "include/v8-proxy.h",
    "include/v8-regexp.h",
    "include/v8-script.h",
    "include/v8-snapshot.h",
    "include/v8-statistics.h",
    "include/v8-template.h",
    "include/v8-traced-handle.h",
    "include/v8-typed-array.h",
    "include/v8-unwinder.h",
    "include/v8-util.h",
    "include/v8-value-serializer.h",
    "include/v8-value.h",
    "include/v8-wasm.h",
    "include/v8-weak-callback-info.h",
    "include/v8.h",
  ]

  sources += [
    # The following headers cannot be platform-specific. The include validation
    # of `gn gen $dir --check` requires all header files to be available on all
    # platforms.
    "include/v8-wasm-trap-handler-posix.h",
    "include/v8-wasm-trap-handler-win.h",
  ]

  public_deps = [ ":v8_config_headers" ]

  deps = [
    ":cppgc_headers",
    ":v8_version",
  ]
}

if (v8_generate_external_defines_header) {
  action("gen_v8_gn") {
    visibility = [ ":*" ]

    script = "tools/gen-v8-gn.py"
    outputs = [ "$target_gen_dir/include/v8-gn.h" ]

    args = [
      "-o",
      rebase_path("$target_gen_dir/include/v8-gn.h", root_build_dir),
    ]
    foreach(define, enabled_external_defines) {
      args += [
        "-p",
        define,
      ]
    }
    foreach(define, disabled_external_defines) {
      args += [
        "-n",
        define,
      ]
    }
  }
}

# This is split out to share basic headers with Torque and everything else:(
v8_header_set("v8_shared_internal_headers") {
  visibility = [
    ":*",
    "test/*",
    "tools/*",
  ]
  configs = [ ":internal_config" ]

  sources = [
    "src/common/globals.h",
    "src/wasm/wasm-constants.h",
    "src/wasm/wasm-limits.h",
  ]

  deps = [
    ":v8_headers",
    ":v8_libbase",
  ]
}

v8_header_set("v8_flags") {
  visibility = [
    ":*",
    "tools/*",
  ]

  configs = [ ":internal_config" ]

  sources = [
    "src/flags/flag-definitions.h",
    "src/flags/flags-impl.h",
    "src/flags/flags.h",
  ]

  deps = [
    ":v8_libbase",
    ":v8_shared_internal_headers",
  ]
}

v8_header_set("v8_internal_headers") {
  configs = [ ":internal_config" ]

  public_configs = [ "src/inspector:inspector_config" ]

  sources = [
    ### gcmole(all) ###
    "$target_gen_dir/builtins-generated/bytecodes-builtins-list.h",
    "//base/trace_event/common/trace_event_common.h",
    "include/cppgc/common.h",
    "include/v8-inspector-protocol.h",
    "include/v8-inspector.h",
    "include/v8-metrics.h",
    "include/v8-unwinder-state.h",
    "include/v8-wasm-trap-handler-posix.h",
    "src/api/api-arguments-inl.h",
    "src/api/api-arguments.h",
    "src/api/api-inl.h",
    "src/api/api-macros-undef.h",
    "src/api/api-macros.h",
    "src/api/api-natives.h",
    "src/api/api.h",
    "src/ast/ast-function-literal-id-reindexer.h",
    "src/ast/ast-source-ranges.h",
    "src/ast/ast-traversal-visitor.h",
    "src/ast/ast-value-factory.h",
    "src/ast/ast.h",
    "src/ast/modules.h",
    "src/ast/prettyprinter.h",
    "src/ast/scopes.h",
    "src/ast/source-range-ast-visitor.h",
    "src/ast/variables.h",
    "src/baseline/baseline.h",
    "src/baseline/bytecode-offset-iterator.h",
    "src/builtins/accessors.h",
    "src/builtins/builtins-constructor.h",
    "src/builtins/builtins-definitions.h",
    "src/builtins/builtins-descriptors.h",
    "src/builtins/builtins-inl.h",
    "src/builtins/builtins-promise.h",
    "src/builtins/builtins-utils-inl.h",
    "src/builtins/builtins-utils.h",
    "src/builtins/builtins.h",
    "src/builtins/constants-table-builder.h",
    "src/builtins/data-view-ops.h",
    "src/builtins/profile-data-reader.h",
    "src/codegen/aligned-slot-allocator.h",
    "src/codegen/assembler-arch.h",
    "src/codegen/assembler-inl.h",
    "src/codegen/assembler.h",
    "src/codegen/atomic-memory-order.h",
    "src/codegen/background-merge-task.h",
    "src/codegen/bailout-reason.h",
    "src/codegen/callable.h",
    "src/codegen/code-comments.h",
    "src/codegen/code-desc.h",
    "src/codegen/code-factory.h",
    "src/codegen/code-reference.h",
    "src/codegen/compilation-cache.h",
    "src/codegen/compiler.h",
    "src/codegen/constant-pool.h",
    "src/codegen/constants-arch.h",
    "src/codegen/cpu-features.h",
    "src/codegen/external-reference-encoder.h",
    "src/codegen/external-reference-table.h",
    "src/codegen/external-reference.h",
    "src/codegen/flush-instruction-cache.h",
    "src/codegen/handler-table.h",
    "src/codegen/interface-descriptors-inl.h",
    "src/codegen/interface-descriptors.h",
    "src/codegen/label.h",
    "src/codegen/linkage-location.h",
    "src/codegen/machine-type.h",
    "src/codegen/macro-assembler-base.h",
    "src/codegen/macro-assembler-inl.h",
    "src/codegen/macro-assembler.h",
    "src/codegen/maglev-safepoint-table.h",
    "src/codegen/optimized-compilation-info.h",
    "src/codegen/pending-optimization-table.h",
    "src/codegen/register-arch.h",
    "src/codegen/register-base.h",
    "src/codegen/register-configuration.h",
    "src/codegen/register.h",
    "src/codegen/reglist-base.h",
    "src/codegen/reglist.h",
    "src/codegen/reloc-info-inl.h",
    "src/codegen/reloc-info.h",
    "src/codegen/safepoint-table-base.h",
    "src/codegen/safepoint-table.h",
    "src/codegen/script-details.h",
    "src/codegen/signature.h",
    "src/codegen/source-position-table.h",
    "src/codegen/source-position.h",
    "src/codegen/tick-counter.h",
    "src/codegen/tnode.h",
    "src/codegen/unoptimized-compilation-info.h",
    "src/common/assert-scope.h",
    "src/common/checks.h",
    "src/common/code-memory-access-inl.h",
    "src/common/code-memory-access.h",
    "src/common/high-allocation-throughput-scope.h",
    "src/common/message-template.h",
    "src/common/operation.h",
    "src/common/ptr-compr-inl.h",
    "src/common/ptr-compr.h",
    "src/compiler-dispatcher/lazy-compile-dispatcher.h",
    "src/compiler-dispatcher/optimizing-compile-dispatcher.h",
    "src/compiler/access-builder.h",
    "src/compiler/access-info.h",
    "src/compiler/add-type-assertions-reducer.h",
    "src/compiler/all-nodes.h",
    "src/compiler/allocation-builder-inl.h",
    "src/compiler/allocation-builder.h",
    "src/compiler/backend/bitcast-elider.h",
    "src/compiler/backend/code-generator-impl.h",
    "src/compiler/backend/code-generator.h",
    "src/compiler/backend/frame-elider.h",
    "src/compiler/backend/gap-resolver.h",
    "src/compiler/backend/instruction-codes.h",
    "src/compiler/backend/instruction-scheduler.h",
    "src/compiler/backend/instruction-selector-adapter.h",
    "src/compiler/backend/instruction-selector-impl.h",
    "src/compiler/backend/instruction-selector.h",
    "src/compiler/backend/instruction.h",
    "src/compiler/backend/jump-threading.h",
    "src/compiler/backend/move-optimizer.h",
    "src/compiler/backend/register-allocation.h",
    "src/compiler/backend/register-allocator-verifier.h",
    "src/compiler/backend/register-allocator.h",
    "src/compiler/backend/spill-placer.h",
    "src/compiler/backend/unwinding-info-writer.h",
    "src/compiler/basic-block-instrumentor.h",
    "src/compiler/branch-condition-duplicator.h",
    "src/compiler/branch-elimination.h",
    "src/compiler/bytecode-analysis.h",
    "src/compiler/bytecode-graph-builder.h",
    "src/compiler/bytecode-liveness-map.h",
    "src/compiler/checkpoint-elimination.h",
    "src/compiler/code-assembler.h",
    "src/compiler/common-node-cache.h",
    "src/compiler/common-operator-reducer.h",
    "src/compiler/common-operator.h",
    "src/compiler/compilation-dependencies.h",
    "src/compiler/compiler-source-position-table.h",
    "src/compiler/const-tracking-let-helpers.h",
    "src/compiler/constant-folding-reducer.h",
    "src/compiler/control-equivalence.h",
    "src/compiler/control-flow-optimizer.h",
    "src/compiler/control-path-state.h",
    "src/compiler/csa-load-elimination.h",
    "src/compiler/dead-code-elimination.h",
    "src/compiler/decompression-optimizer.h",
    "src/compiler/diamond.h",
    "src/compiler/effect-control-linearizer.h",
    "src/compiler/escape-analysis-reducer.h",
    "src/compiler/escape-analysis.h",
    "src/compiler/fast-api-calls.h",
    "src/compiler/feedback-source.h",
    "src/compiler/frame-states.h",
    "src/compiler/frame.h",
    "src/compiler/functional-list.h",
    "src/compiler/globals.h",
    "src/compiler/graph-assembler.h",
    "src/compiler/graph-reducer.h",
    "src/compiler/graph-trimmer.h",
    "src/compiler/graph-visualizer.h",
    "src/compiler/graph-zone-traits.h",
    "src/compiler/graph.h",
    "src/compiler/heap-refs.h",
    "src/compiler/js-call-reducer.h",
    "src/compiler/js-context-specialization.h",
    "src/compiler/js-create-lowering.h",
    "src/compiler/js-generic-lowering.h",
    "src/compiler/js-graph.h",
    "src/compiler/js-heap-broker-inl.h",
    "src/compiler/js-heap-broker.h",
    "src/compiler/js-inlining-heuristic.h",
    "src/compiler/js-inlining.h",
    "src/compiler/js-intrinsic-lowering.h",
    "src/compiler/js-native-context-specialization.h",
    "src/compiler/js-operator.h",
    "src/compiler/js-type-hint-lowering.h",
    "src/compiler/js-typed-lowering.h",
    "src/compiler/late-escape-analysis.h",
    "src/compiler/linkage.h",
    "src/compiler/load-elimination.h",
    "src/compiler/loop-analysis.h",
    "src/compiler/loop-peeling.h",
    "src/compiler/loop-unrolling.h",
    "src/compiler/loop-variable-optimizer.h",
    "src/compiler/machine-graph-verifier.h",
    "src/compiler/machine-graph.h",
    "src/compiler/machine-operator-reducer.h",
    "src/compiler/machine-operator.h",
    "src/compiler/map-inference.h",
    "src/compiler/memory-lowering.h",
    "src/compiler/memory-optimizer.h",
    "src/compiler/node-aux-data.h",
    "src/compiler/node-cache.h",
    "src/compiler/node-marker.h",
    "src/compiler/node-matchers.h",
    "src/compiler/node-observer.h",
    "src/compiler/node-origin-table.h",
    "src/compiler/node-properties.h",
    "src/compiler/node.h",
    "src/compiler/opcodes.h",
    "src/compiler/operation-typer.h",
    "src/compiler/operator-properties.h",
    "src/compiler/operator.h",
    "src/compiler/osr.h",
    "src/compiler/pair-load-store-reducer.h",
    "src/compiler/per-isolate-compiler-cache.h",
    "src/compiler/persistent-map.h",
    "src/compiler/phase.h",
    "src/compiler/pipeline-statistics.h",
    "src/compiler/pipeline.h",
    "src/compiler/processed-feedback.h",
    "src/compiler/property-access-builder.h",
    "src/compiler/raw-machine-assembler.h",
    "src/compiler/redundancy-elimination.h",
    "src/compiler/refs-map.h",
    "src/compiler/representation-change.h",
    "src/compiler/schedule.h",
    "src/compiler/scheduler.h",
    "src/compiler/select-lowering.h",
    "src/compiler/simplified-lowering-verifier.h",
    "src/compiler/simplified-lowering.h",
    "src/compiler/simplified-operator-reducer.h",
    "src/compiler/simplified-operator.h",
    "src/compiler/state-values-utils.h",
    "src/compiler/store-store-elimination.h",
    "src/compiler/string-builder-optimizer.h",
    "src/compiler/turbofan.h",
    "src/compiler/turboshaft/analyzer-iterator.h",
    "src/compiler/turboshaft/assembler.h",
    "src/compiler/turboshaft/assert-types-reducer.h",
    "src/compiler/turboshaft/branch-elimination-reducer.h",
    "src/compiler/turboshaft/build-graph-phase.h",
    "src/compiler/turboshaft/builtin-call-descriptors.h",
    "src/compiler/turboshaft/code-elimination-and-simplification-phase.h",
    "src/compiler/turboshaft/copying-phase.h",
    "src/compiler/turboshaft/csa-optimize-phase.h",
    "src/compiler/turboshaft/dataview-lowering-reducer.h",
    "src/compiler/turboshaft/dead-code-elimination-reducer.h",
    "src/compiler/turboshaft/debug-feature-lowering-phase.h",
    "src/compiler/turboshaft/debug-feature-lowering-reducer.h",
    "src/compiler/turboshaft/decompression-optimization-phase.h",
    "src/compiler/turboshaft/decompression-optimization.h",
    "src/compiler/turboshaft/define-assembler-macros.inc",
    "src/compiler/turboshaft/deopt-data.h",
    "src/compiler/turboshaft/duplication-optimization-reducer.h",
    "src/compiler/turboshaft/explicit-truncation-reducer.h",
    "src/compiler/turboshaft/fast-api-call-lowering-reducer.h",
    "src/compiler/turboshaft/fast-hash.h",
    "src/compiler/turboshaft/graph-builder.h",
    "src/compiler/turboshaft/graph-visualizer.h",
    "src/compiler/turboshaft/graph.h",
    "src/compiler/turboshaft/index.h",
    "src/compiler/turboshaft/instruction-selection-phase.h",
    "src/compiler/turboshaft/js-generic-lowering-reducer.h",
    "src/compiler/turboshaft/late-escape-analysis-reducer.h",
    "src/compiler/turboshaft/late-load-elimination-reducer.h",
    "src/compiler/turboshaft/layered-hash-map.h",
    "src/compiler/turboshaft/load-store-simplification-reducer.h",
    "src/compiler/turboshaft/loop-finder.h",
    "src/compiler/turboshaft/loop-peeling-phase.h",
    "src/compiler/turboshaft/loop-peeling-reducer.h",
    "src/compiler/turboshaft/loop-unrolling-phase.h",
    "src/compiler/turboshaft/loop-unrolling-reducer.h",
    "src/compiler/turboshaft/machine-lowering-phase.h",
    "src/compiler/turboshaft/machine-lowering-reducer-inl.h",
    "src/compiler/turboshaft/machine-optimization-reducer.h",
    "src/compiler/turboshaft/maglev-early-lowering-reducer-inl.h",
    "src/compiler/turboshaft/maglev-graph-building-phase.h",
    "src/compiler/turboshaft/memory-optimization-reducer.h",
    "src/compiler/turboshaft/operation-matcher.h",
    "src/compiler/turboshaft/operations.h",
    "src/compiler/turboshaft/opmasks.h",
    "src/compiler/turboshaft/optimize-phase.h",
    "src/compiler/turboshaft/phase.h",
    "src/compiler/turboshaft/pretenuring-propagation-reducer.h",
    "src/compiler/turboshaft/recreate-schedule-phase.h",
    "src/compiler/turboshaft/recreate-schedule.h",
    "src/compiler/turboshaft/reducer-traits.h",
    "src/compiler/turboshaft/representations.h",
    "src/compiler/turboshaft/required-optimization-reducer.h",
    "src/compiler/turboshaft/runtime-call-descriptors.h",
    "src/compiler/turboshaft/select-lowering-reducer.h",
    "src/compiler/turboshaft/sidetable.h",
    "src/compiler/turboshaft/simplified-lowering-phase.h",
    "src/compiler/turboshaft/simplified-lowering-reducer.h",
    "src/compiler/turboshaft/simplify-tf-loops.h",
    "src/compiler/turboshaft/snapshot-table-opindex.h",
    "src/compiler/turboshaft/snapshot-table.h",
    "src/compiler/turboshaft/stack-check-lowering-reducer.h",
    "src/compiler/turboshaft/store-store-elimination-phase.h",
    "src/compiler/turboshaft/store-store-elimination-reducer.h",
    "src/compiler/turboshaft/structural-optimization-reducer.h",
    "src/compiler/turboshaft/tracing.h",
    "src/compiler/turboshaft/type-assertions-phase.h",
    "src/compiler/turboshaft/type-inference-analysis.h",
    "src/compiler/turboshaft/type-inference-reducer.h",
    "src/compiler/turboshaft/type-parser.h",
    "src/compiler/turboshaft/typed-optimizations-phase.h",
    "src/compiler/turboshaft/typed-optimizations-reducer.h",
    "src/compiler/turboshaft/typer.h",
    "src/compiler/turboshaft/types.h",
    "src/compiler/turboshaft/undef-assembler-macros.inc",
    "src/compiler/turboshaft/uniform-reducer-adapter.h",
    "src/compiler/turboshaft/use-map.h",
    "src/compiler/turboshaft/utils.h",
    "src/compiler/turboshaft/value-numbering-reducer.h",
    "src/compiler/turboshaft/variable-reducer.h",
    "src/compiler/turboshaft/wasm-dead-code-elimination-phase.h",
    "src/compiler/type-cache.h",
    "src/compiler/type-narrowing-reducer.h",
    "src/compiler/typed-optimization.h",
    "src/compiler/typer.h",
    "src/compiler/types.h",
    "src/compiler/use-info.h",
    "src/compiler/value-numbering-reducer.h",
    "src/compiler/verifier.h",
    "src/compiler/write-barrier-kind.h",
    "src/compiler/zone-stats.h",
    "src/date/date.h",
    "src/date/dateparser-inl.h",
    "src/date/dateparser.h",
    "src/debug/debug-coverage.h",
    "src/debug/debug-evaluate.h",
    "src/debug/debug-frames.h",
    "src/debug/debug-interface.h",
    "src/debug/debug-property-iterator.h",
    "src/debug/debug-scope-iterator.h",
    "src/debug/debug-scopes.h",
    "src/debug/debug-stack-trace-iterator.h",
    "src/debug/debug.h",
    "src/debug/interface-types.h",
    "src/debug/liveedit-diff.h",
    "src/debug/liveedit.h",
    "src/deoptimizer/deoptimize-reason.h",
    "src/deoptimizer/deoptimized-frame-info.h",
    "src/deoptimizer/deoptimizer.h",
    "src/deoptimizer/frame-description.h",
    "src/deoptimizer/frame-translation-builder.h",
    "src/deoptimizer/materialized-object-store.h",
    "src/deoptimizer/translated-state.h",
    "src/deoptimizer/translation-opcode.h",
    "src/diagnostics/basic-block-profiler.h",
    "src/diagnostics/code-tracer.h",
    "src/diagnostics/compilation-statistics.h",
    "src/diagnostics/disasm.h",
    "src/diagnostics/disassembler.h",
    "src/diagnostics/eh-frame.h",
    "src/diagnostics/gdb-jit.h",
    "src/diagnostics/perf-jit.h",
    "src/diagnostics/unwinder.h",
    "src/execution/arguments-inl.h",
    "src/execution/arguments.h",
    "src/execution/clobber-registers.h",
    "src/execution/embedder-state.h",
    "src/execution/encoded-c-signature.h",
    "src/execution/execution.h",
    "src/execution/frame-constants.h",
    "src/execution/frames-inl.h",
    "src/execution/frames.h",
    "src/execution/futex-emulation.h",
    "src/execution/interrupts-scope.h",
    "src/execution/isolate-data.h",
    "src/execution/isolate-inl.h",
    "src/execution/isolate-utils-inl.h",
    "src/execution/isolate-utils.h",
    "src/execution/isolate.h",
    "src/execution/local-isolate-inl.h",
    "src/execution/local-isolate.h",
    "src/execution/messages.h",
    "src/execution/microtask-queue.h",
    "src/execution/pointer-authentication.h",
    "src/execution/protectors-inl.h",
    "src/execution/protectors.h",
    "src/execution/shared-mutex-guard-if-off-thread.h",
    "src/execution/simulator-base.h",
    "src/execution/simulator.h",
    "src/execution/stack-guard.h",
    "src/execution/thread-id.h",
    "src/execution/thread-local-top.h",
    "src/execution/tiering-manager.h",
    "src/execution/v8threads.h",
    "src/execution/vm-state-inl.h",
    "src/execution/vm-state.h",
    "src/extensions/cputracemark-extension.h",
    "src/extensions/externalize-string-extension.h",
    "src/extensions/gc-extension.h",
    "src/extensions/ignition-statistics-extension.h",
    "src/extensions/statistics-extension.h",
    "src/extensions/trigger-failure-extension.h",
    "src/handles/global-handles-inl.h",
    "src/handles/global-handles.h",
    "src/handles/handles-inl.h",
    "src/handles/handles.h",
    "src/handles/local-handles-inl.h",
    "src/handles/local-handles.h",
    "src/handles/maybe-handles-inl.h",
    "src/handles/maybe-handles.h",
    "src/handles/persistent-handles.h",
    "src/handles/shared-object-conveyor-handles.h",
    "src/handles/traced-handles-inl.h",
    "src/handles/traced-handles.h",
    "src/heap/allocation-observer.h",
    "src/heap/allocation-result.h",
    "src/heap/allocation-stats.h",
    "src/heap/array-buffer-sweeper.h",
    "src/heap/base-space.h",
    "src/heap/code-range.h",
    "src/heap/code-stats.h",
    "src/heap/collection-barrier.h",
    "src/heap/combined-heap.h",
    "src/heap/concurrent-marking.h",
    "src/heap/cppgc-js/cpp-heap.h",
    "src/heap/cppgc-js/cpp-marking-state-inl.h",
    "src/heap/cppgc-js/cpp-marking-state.h",
    "src/heap/cppgc-js/cpp-snapshot.h",
    "src/heap/cppgc-js/cross-heap-remembered-set.h",
    "src/heap/cppgc-js/unified-heap-marking-state-inl.h",
    "src/heap/cppgc-js/unified-heap-marking-state.h",
    "src/heap/cppgc-js/unified-heap-marking-verifier.h",
    "src/heap/cppgc-js/unified-heap-marking-visitor.h",
    "src/heap/cppgc-js/wrappable-info-inl.h",
    "src/heap/cppgc-js/wrappable-info.h",
    "src/heap/ephemeron-remembered-set.h",
    "src/heap/evacuation-allocator-inl.h",
    "src/heap/evacuation-allocator.h",
    "src/heap/evacuation-verifier-inl.h",
    "src/heap/evacuation-verifier.h",
    "src/heap/factory-base-inl.h",
    "src/heap/factory-base.h",
    "src/heap/factory-inl.h",
    "src/heap/factory.h",
    "src/heap/finalization-registry-cleanup-task.h",
    "src/heap/free-list-inl.h",
    "src/heap/free-list.h",
    "src/heap/gc-callbacks.h",
    "src/heap/gc-idle-time-handler.h",
    "src/heap/gc-tracer-inl.h",
    "src/heap/gc-tracer.h",
    "src/heap/heap-allocator-inl.h",
    "src/heap/heap-allocator.h",
    "src/heap/heap-controller.h",
    "src/heap/heap-inl.h",
    "src/heap/heap-layout-tracer.h",
    "src/heap/heap-write-barrier-inl.h",
    "src/heap/heap-write-barrier.h",
    "src/heap/heap.h",
    "src/heap/incremental-marking-inl.h",
    "src/heap/incremental-marking-job.h",
    "src/heap/incremental-marking.h",
    "src/heap/index-generator.h",
    "src/heap/large-page.h",
    "src/heap/large-spaces.h",
    "src/heap/linear-allocation-area.h",
    "src/heap/list.h",
    "src/heap/local-factory-inl.h",
    "src/heap/local-factory.h",
    "src/heap/local-heap-inl.h",
    "src/heap/local-heap.h",
    "src/heap/main-allocator-inl.h",
    "src/heap/main-allocator.h",
    "src/heap/mark-compact-inl.h",
    "src/heap/mark-compact.h",
    "src/heap/mark-sweep-utilities.h",
    "src/heap/marking-barrier-inl.h",
    "src/heap/marking-barrier.h",
    "src/heap/marking-inl.h",
    "src/heap/marking-state-inl.h",
    "src/heap/marking-state.h",
    "src/heap/marking-visitor-inl.h",
    "src/heap/marking-visitor.h",
    "src/heap/marking-worklist-inl.h",
    "src/heap/marking-worklist.h",
    "src/heap/marking.h",
    "src/heap/memory-allocator.h",
    "src/heap/memory-balancer.h",
    "src/heap/memory-chunk-layout.h",
    "src/heap/memory-chunk-metadata.h",
    "src/heap/memory-chunk.h",
    "src/heap/memory-measurement-inl.h",
    "src/heap/memory-measurement.h",
    "src/heap/memory-reducer.h",
    "src/heap/minor-gc-job.h",
    "src/heap/minor-mark-sweep-inl.h",
    "src/heap/minor-mark-sweep.h",
    "src/heap/mutable-page-inl.h",
    "src/heap/mutable-page.h",
    "src/heap/new-spaces-inl.h",
    "src/heap/new-spaces.h",
    "src/heap/object-lock.h",
    "src/heap/object-stats.h",
    "src/heap/objects-visiting-inl.h",
    "src/heap/objects-visiting.h",
    "src/heap/page.h",
    "src/heap/paged-spaces-inl.h",
    "src/heap/paged-spaces.h",
    "src/heap/parallel-work-item.h",
    "src/heap/parked-scope-inl.h",
    "src/heap/parked-scope.h",
    "src/heap/pretenuring-handler-inl.h",
    "src/heap/pretenuring-handler.h",
    "src/heap/progress-bar.h",
    "src/heap/read-only-heap-inl.h",
    "src/heap/read-only-heap.h",
    "src/heap/read-only-promotion.h",
    "src/heap/read-only-spaces.h",
    "src/heap/remembered-set-inl.h",
    "src/heap/remembered-set.h",
    "src/heap/safepoint.h",
    "src/heap/scavenger-inl.h",
    "src/heap/scavenger.h",
    "src/heap/slot-set.h",
    "src/heap/spaces-inl.h",
    "src/heap/spaces.h",
    "src/heap/sweeper.h",
    "src/heap/traced-handles-marking-visitor.h",
    "src/heap/trusted-range.h",
    "src/heap/weak-object-worklists.h",
    "src/heap/young-generation-marking-visitor-inl.h",
    "src/heap/young-generation-marking-visitor.h",
    "src/heap/zapping.h",
    "src/ic/call-optimization.h",
    "src/ic/handler-configuration-inl.h",
    "src/ic/handler-configuration.h",
    "src/ic/ic-inl.h",
    "src/ic/ic-stats.h",
    "src/ic/ic.h",
    "src/ic/stub-cache.h",
    "src/init/bootstrapper.h",
    "src/init/heap-symbols.h",
    "src/init/icu_util.h",
    "src/init/isolate-allocator.h",
    "src/init/setup-isolate.h",
    "src/init/startup-data-util.h",
    "src/init/v8.h",
    "src/interpreter/block-coverage-builder.h",
    "src/interpreter/bytecode-array-builder.h",
    "src/interpreter/bytecode-array-iterator.h",
    "src/interpreter/bytecode-array-random-iterator.h",
    "src/interpreter/bytecode-array-writer.h",
    "src/interpreter/bytecode-decoder.h",
    "src/interpreter/bytecode-flags.h",
    "src/interpreter/bytecode-generator.h",
    "src/interpreter/bytecode-jump-table.h",
    "src/interpreter/bytecode-label.h",
    "src/interpreter/bytecode-node.h",
    "src/interpreter/bytecode-operands.h",
    "src/interpreter/bytecode-register-allocator.h",
    "src/interpreter/bytecode-register-optimizer.h",
    "src/interpreter/bytecode-register.h",
    "src/interpreter/bytecode-source-info.h",
    "src/interpreter/bytecode-traits.h",
    "src/interpreter/bytecodes.h",
    "src/interpreter/constant-array-builder.h",
    "src/interpreter/control-flow-builders.h",
    "src/interpreter/handler-table-builder.h",
    "src/interpreter/interpreter-generator.h",
    "src/interpreter/interpreter-intrinsics.h",
    "src/interpreter/interpreter.h",
    "src/json/json-parser.h",
    "src/json/json-stringifier.h",
    "src/libsampler/sampler.h",
    "src/logging/code-events.h",
    "src/logging/counters-definitions.h",
    "src/logging/counters-scopes.h",
    "src/logging/counters.h",
    "src/logging/local-logger.h",
    "src/logging/log-file.h",
    "src/logging/log-inl.h",
    "src/logging/log.h",
    "src/logging/metrics.h",
    "src/logging/runtime-call-stats-scope.h",
    "src/logging/runtime-call-stats.h",
    "src/logging/tracing-flags.h",
    "src/numbers/conversions-inl.h",
    "src/numbers/conversions.h",
    "src/numbers/hash-seed-inl.h",
    "src/numbers/math-random.h",
    "src/objects/all-objects-inl.h",
    "src/objects/allocation-site-inl.h",
    "src/objects/allocation-site-scopes-inl.h",
    "src/objects/allocation-site-scopes.h",
    "src/objects/allocation-site.h",
    "src/objects/api-callbacks-inl.h",
    "src/objects/api-callbacks.h",
    "src/objects/arguments-inl.h",
    "src/objects/arguments.h",
    "src/objects/backing-store.h",
    "src/objects/bigint-inl.h",
    "src/objects/bigint.h",
    "src/objects/call-site-info-inl.h",
    "src/objects/call-site-info.h",
    "src/objects/cell-inl.h",
    "src/objects/cell.h",
    "src/objects/code-inl.h",
    "src/objects/code-kind.h",
    "src/objects/code.h",
    "src/objects/compilation-cache-table-inl.h",
    "src/objects/compilation-cache-table.h",
    "src/objects/compressed-slots-inl.h",
    "src/objects/compressed-slots.h",
    "src/objects/contexts-inl.h",
    "src/objects/contexts.h",
    "src/objects/data-handler-inl.h",
    "src/objects/data-handler.h",
    "src/objects/debug-objects-inl.h",
    "src/objects/debug-objects.h",
    "src/objects/descriptor-array-inl.h",
    "src/objects/descriptor-array.h",
    "src/objects/dictionary-inl.h",
    "src/objects/dictionary.h",
    "src/objects/elements-inl.h",
    "src/objects/elements-kind.h",
    "src/objects/elements.h",
    "src/objects/embedder-data-array-inl.h",
    "src/objects/embedder-data-array.h",
    "src/objects/embedder-data-slot-inl.h",
    "src/objects/embedder-data-slot.h",
    "src/objects/feedback-cell-inl.h",
    "src/objects/feedback-cell.h",
    "src/objects/feedback-vector-inl.h",
    "src/objects/feedback-vector.h",
    "src/objects/field-index-inl.h",
    "src/objects/field-index.h",
    "src/objects/field-type.h",
    "src/objects/fixed-array-inl.h",
    "src/objects/fixed-array.h",
    "src/objects/foreign-inl.h",
    "src/objects/foreign.h",
    "src/objects/free-space-inl.h",
    "src/objects/free-space.h",
    "src/objects/function-kind.h",
    "src/objects/function-syntax-kind.h",
    "src/objects/hash-table-inl.h",
    "src/objects/hash-table.h",
    "src/objects/heap-number-inl.h",
    "src/objects/heap-number.h",
    "src/objects/heap-object-inl.h",
    "src/objects/heap-object.h",
    "src/objects/hole-inl.h",
    "src/objects/hole.h",
    "src/objects/instance-type-checker.h",
    "src/objects/instance-type-inl.h",
    "src/objects/instance-type.h",
    "src/objects/internal-index.h",
    "src/objects/js-array-buffer-inl.h",
    "src/objects/js-array-buffer.h",
    "src/objects/js-array-inl.h",
    "src/objects/js-array.h",
    "src/objects/js-atomics-synchronization-inl.h",
    "src/objects/js-atomics-synchronization.h",
    "src/objects/js-collection-inl.h",
    "src/objects/js-collection-iterator-inl.h",
    "src/objects/js-collection-iterator.h",
    "src/objects/js-collection.h",
    "src/objects/js-function-inl.h",
    "src/objects/js-function.h",
    "src/objects/js-generator-inl.h",
    "src/objects/js-generator.h",
    "src/objects/js-iterator-helpers-inl.h",
    "src/objects/js-iterator-helpers.h",
    "src/objects/js-objects-inl.h",
    "src/objects/js-objects.h",
    "src/objects/js-promise-inl.h",
    "src/objects/js-promise.h",
    "src/objects/js-proxy-inl.h",
    "src/objects/js-proxy.h",
    "src/objects/js-raw-json-inl.h",
    "src/objects/js-raw-json.h",
    "src/objects/js-regexp-inl.h",
    "src/objects/js-regexp-string-iterator-inl.h",
    "src/objects/js-regexp-string-iterator.h",
    "src/objects/js-regexp.h",
    "src/objects/js-segments-inl.h",
    "src/objects/js-segments.h",
    "src/objects/js-shadow-realm-inl.h",
    "src/objects/js-shadow-realm.h",
    "src/objects/js-shared-array-inl.h",
    "src/objects/js-shared-array.h",
    "src/objects/js-struct-inl.h",
    "src/objects/js-struct.h",
    "src/objects/js-temporal-objects-inl.h",
    "src/objects/js-temporal-objects.h",
    "src/objects/js-weak-refs-inl.h",
    "src/objects/js-weak-refs.h",
    "src/objects/keys.h",
    "src/objects/literal-objects-inl.h",
    "src/objects/literal-objects.h",
    "src/objects/lookup-cache-inl.h",
    "src/objects/lookup-cache.h",
    "src/objects/lookup-inl.h",
    "src/objects/lookup.h",
    "src/objects/managed-inl.h",
    "src/objects/managed.h",
    "src/objects/map-inl.h",
    "src/objects/map-updater.h",
    "src/objects/map.h",
    "src/objects/maybe-object-inl.h",
    "src/objects/maybe-object.h",
    "src/objects/megadom-handler-inl.h",
    "src/objects/megadom-handler.h",
    "src/objects/microtask-inl.h",
    "src/objects/microtask.h",
    "src/objects/module-inl.h",
    "src/objects/module.h",
    "src/objects/name-inl.h",
    "src/objects/name.h",
    "src/objects/object-list-macros.h",
    "src/objects/object-macros-undef.h",
    "src/objects/object-macros.h",
    "src/objects/object-type.h",
    "src/objects/objects-body-descriptors-inl.h",
    "src/objects/objects-body-descriptors.h",
    "src/objects/objects-definitions.h",
    "src/objects/objects-inl.h",
    "src/objects/objects.h",
    "src/objects/oddball-inl.h",
    "src/objects/oddball.h",
    "src/objects/off-heap-hash-table-inl.h",
    "src/objects/off-heap-hash-table.h",
    "src/objects/option-utils.h",
    "src/objects/ordered-hash-table-inl.h",
    "src/objects/ordered-hash-table.h",
    "src/objects/primitive-heap-object-inl.h",
    "src/objects/primitive-heap-object.h",
    "src/objects/promise-inl.h",
    "src/objects/promise.h",
    "src/objects/property-array-inl.h",
    "src/objects/property-array.h",
    "src/objects/property-cell-inl.h",
    "src/objects/property-cell.h",
    "src/objects/property-descriptor-object-inl.h",
    "src/objects/property-descriptor-object.h",
    "src/objects/property-descriptor.h",
    "src/objects/property-details.h",
    "src/objects/property.h",
    "src/objects/prototype-info-inl.h",
    "src/objects/prototype-info.h",
    "src/objects/prototype-inl.h",
    "src/objects/prototype.h",
    "src/objects/regexp-match-info.h",
    "src/objects/scope-info-inl.h",
    "src/objects/scope-info.h",
    "src/objects/script-inl.h",
    "src/objects/script.h",
    "src/objects/shared-function-info-inl.h",
    "src/objects/shared-function-info.h",
    "src/objects/simd.h",
    "src/objects/slots-atomic-inl.h",
    "src/objects/slots-inl.h",
    "src/objects/slots.h",
    "src/objects/smi-inl.h",
    "src/objects/smi.h",
    "src/objects/source-text-module-inl.h",
    "src/objects/source-text-module.h",
    "src/objects/string-comparator.h",
    "src/objects/string-forwarding-table-inl.h",
    "src/objects/string-forwarding-table.h",
    "src/objects/string-inl.h",
    "src/objects/string-set-inl.h",
    "src/objects/string-set.h",
    "src/objects/string-table-inl.h",
    "src/objects/string-table.h",
    "src/objects/string.h",
    "src/objects/struct-inl.h",
    "src/objects/struct.h",
    "src/objects/swiss-hash-table-helpers.h",
    "src/objects/swiss-name-dictionary-inl.h",
    "src/objects/swiss-name-dictionary.h",
    "src/objects/synthetic-module-inl.h",
    "src/objects/synthetic-module.h",
    "src/objects/tagged-field-inl.h",
    "src/objects/tagged-field.h",
    "src/objects/tagged-impl-inl.h",
    "src/objects/tagged-impl.h",
    "src/objects/tagged-index.h",
    "src/objects/tagged-value-inl.h",
    "src/objects/tagged-value.h",
    "src/objects/tagged.h",
    "src/objects/template-objects-inl.h",
    "src/objects/template-objects.h",
    "src/objects/templates-inl.h",
    "src/objects/templates.h",
    "src/objects/torque-defined-classes-inl.h",
    "src/objects/torque-defined-classes.h",
    "src/objects/transitions-inl.h",
    "src/objects/transitions.h",
    "src/objects/trusted-object-inl.h",
    "src/objects/trusted-object.h",
    "src/objects/turbofan-types-inl.h",
    "src/objects/turbofan-types.h",
    "src/objects/turboshaft-types-inl.h",
    "src/objects/turboshaft-types.h",
    "src/objects/type-hints.h",
    "src/objects/value-serializer.h",
    "src/objects/visitors-inl.h",
    "src/objects/visitors.h",
    "src/parsing/expression-scope.h",
    "src/parsing/func-name-inferrer.h",
    "src/parsing/import-assertions.h",
    "src/parsing/keywords-gen.h",
    "src/parsing/literal-buffer.h",
    "src/parsing/parse-info.h",
    "src/parsing/parser-base.h",
    "src/parsing/parser.h",
    "src/parsing/parsing.h",
    "src/parsing/pending-compilation-error-handler.h",
    "src/parsing/preparse-data-impl.h",
    "src/parsing/preparse-data.h",
    "src/parsing/preparser-logger.h",
    "src/parsing/preparser.h",
    "src/parsing/rewriter.h",
    "src/parsing/scanner-character-streams.h",
    "src/parsing/scanner-inl.h",
    "src/parsing/scanner.h",
    "src/parsing/token.h",
    "src/profiler/allocation-tracker.h",
    "src/profiler/circular-queue-inl.h",
    "src/profiler/circular-queue.h",
    "src/profiler/cpu-profiler-inl.h",
    "src/profiler/cpu-profiler.h",
    "src/profiler/heap-profiler.h",
    "src/profiler/heap-snapshot-generator-inl.h",
    "src/profiler/heap-snapshot-generator.h",
    "src/profiler/output-stream-writer.h",
    "src/profiler/profile-generator-inl.h",
    "src/profiler/profile-generator.h",
    "src/profiler/profiler-listener.h",
    "src/profiler/profiler-stats.h",
    "src/profiler/sampling-heap-profiler.h",
    "src/profiler/strings-storage.h",
    "src/profiler/symbolizer.h",
    "src/profiler/tick-sample.h",
    "src/profiler/tracing-cpu-profiler.h",
    "src/profiler/weak-code-registry.h",
    "src/regexp/experimental/experimental-bytecode.h",
    "src/regexp/experimental/experimental-compiler.h",
    "src/regexp/experimental/experimental-interpreter.h",
    "src/regexp/experimental/experimental.h",
    "src/regexp/regexp-ast.h",
    "src/regexp/regexp-bytecode-generator-inl.h",
    "src/regexp/regexp-bytecode-generator.h",
    "src/regexp/regexp-bytecode-peephole.h",
    "src/regexp/regexp-bytecodes.h",
    "src/regexp/regexp-compiler.h",
    "src/regexp/regexp-dotprinter.h",
    "src/regexp/regexp-error.h",
    "src/regexp/regexp-flags.h",
    "src/regexp/regexp-interpreter.h",
    "src/regexp/regexp-macro-assembler-arch.h",
    "src/regexp/regexp-macro-assembler-tracer.h",
    "src/regexp/regexp-macro-assembler.h",
    "src/regexp/regexp-nodes.h",
    "src/regexp/regexp-parser.h",
    "src/regexp/regexp-stack.h",
    "src/regexp/regexp-utils.h",
    "src/regexp/regexp.h",
    "src/regexp/special-case.h",
    "src/roots/roots-inl.h",
    "src/roots/roots.h",
    "src/roots/static-roots.h",
    "src/runtime/runtime-utils.h",
    "src/runtime/runtime.h",
    "src/sandbox/bounded-size-inl.h",
    "src/sandbox/bounded-size.h",
    "src/sandbox/code-entrypoint-tag.h",
    "src/sandbox/code-pointer-inl.h",
    "src/sandbox/code-pointer-table-inl.h",
    "src/sandbox/code-pointer-table.h",
    "src/sandbox/code-pointer.h",
    "src/sandbox/external-entity-table-inl.h",
    "src/sandbox/external-entity-table.h",
    "src/sandbox/external-pointer-inl.h",
    "src/sandbox/external-pointer-table-inl.h",
    "src/sandbox/external-pointer-table.h",
    "src/sandbox/external-pointer.h",
    "src/sandbox/indirect-pointer-inl.h",
    "src/sandbox/indirect-pointer-tag.h",
    "src/sandbox/indirect-pointer.h",
    "src/sandbox/isolate-inl.h",
    "src/sandbox/isolate.h",
    "src/sandbox/sandbox.h",
    "src/sandbox/sandboxed-pointer-inl.h",
    "src/sandbox/sandboxed-pointer.h",
    "src/sandbox/testing.h",
    "src/sandbox/trusted-pointer-table-inl.h",
    "src/sandbox/trusted-pointer-table.h",
    "src/snapshot/code-serializer.h",
    "src/snapshot/context-deserializer.h",
    "src/snapshot/context-serializer.h",
    "src/snapshot/deserializer.h",
    "src/snapshot/embedded/embedded-data-inl.h",
    "src/snapshot/embedded/embedded-data.h",
    "src/snapshot/embedded/embedded-file-writer-interface.h",
    "src/snapshot/object-deserializer.h",
    "src/snapshot/read-only-deserializer.h",
    "src/snapshot/read-only-serializer-deserializer.h",
    "src/snapshot/read-only-serializer.h",
    "src/snapshot/references.h",
    "src/snapshot/roots-serializer.h",
    "src/snapshot/serializer-deserializer.h",
    "src/snapshot/serializer-inl.h",
    "src/snapshot/serializer.h",
    "src/snapshot/shared-heap-deserializer.h",
    "src/snapshot/shared-heap-serializer.h",
    "src/snapshot/snapshot-data.h",
    "src/snapshot/snapshot-source-sink.h",
    "src/snapshot/snapshot-utils.h",
    "src/snapshot/snapshot.h",
    "src/snapshot/sort-builtins.h",
    "src/snapshot/startup-deserializer.h",
    "src/snapshot/startup-serializer.h",
    "src/strings/char-predicates-inl.h",
    "src/strings/char-predicates.h",
    "src/strings/string-builder-inl.h",
    "src/strings/string-case.h",
    "src/strings/string-hasher-inl.h",
    "src/strings/string-hasher.h",
    "src/strings/string-search.h",
    "src/strings/string-stream.h",
    "src/strings/unicode-decoder.h",
    "src/strings/unicode-inl.h",
    "src/strings/unicode.h",
    "src/strings/uri.h",
    "src/tasks/cancelable-task.h",
    "src/tasks/operations-barrier.h",
    "src/tasks/task-utils.h",
    "src/temporal/temporal-parser.h",
    "src/third_party/siphash/halfsiphash.h",
    "src/third_party/utf8-decoder/utf8-decoder.h",
    "src/torque/runtime-macro-shims.h",
    "src/tracing/trace-event.h",
    "src/tracing/traced-value.h",
    "src/tracing/tracing-category-observer.h",
    "src/utils/address-map.h",
    "src/utils/allocation.h",
    "src/utils/bit-vector.h",
    "src/utils/boxed-float.h",
    "src/utils/detachable-vector.h",
    "src/utils/hex-format.h",
    "src/utils/identity-map.h",
    "src/utils/locked-queue-inl.h",
    "src/utils/locked-queue.h",
    "src/utils/memcopy.h",
    "src/utils/ostreams.h",
    "src/utils/scoped-list.h",
    "src/utils/sha-256.h",
    "src/utils/sparse-bit-vector.h",
    "src/utils/utils-inl.h",
    "src/utils/utils.h",
    "src/utils/version.h",
    "src/zone/accounting-allocator.h",
    "src/zone/compressed-zone-ptr.h",
    "src/zone/type-stats.h",
    "src/zone/zone-allocator.h",
    "src/zone/zone-chunk-list.h",
    "src/zone/zone-compact-set.h",
    "src/zone/zone-compression.h",
    "src/zone/zone-containers.h",
    "src/zone/zone-hashmap.h",
    "src/zone/zone-list-inl.h",
    "src/zone/zone-list.h",
    "src/zone/zone-segment.h",
    "src/zone/zone-type-traits.h",
    "src/zone/zone-utils.h",
    "src/zone/zone.h",
  ]

  if (v8_enable_snapshot_compression) {
    sources += [ "src/snapshot/snapshot-compression.h" ]
  }

  if (v8_use_perfetto) {
    sources -= [ "//base/trace_event/common/trace_event_common.h" ]
    sources += [
      "src/tracing/code-data-source.h",
      "src/tracing/code-trace-context.h",
      "src/tracing/perfetto-logger.h",
      "src/tracing/perfetto-utils.h",
    ]
  }

  if (v8_enable_sparkplug) {
    sources += [
      "src/baseline/baseline-assembler-inl.h",
      "src/baseline/baseline-assembler.h",
      "src/baseline/baseline-batch-compiler.h",
      "src/baseline/baseline-compiler.h",
    ]
  }

  if (v8_enable_maglev) {
    sources += [
      "src/maglev/maglev-assembler-inl.h",
      "src/maglev/maglev-assembler.h",
      "src/maglev/maglev-basic-block.h",
      "src/maglev/maglev-code-gen-state.h",
      "src/maglev/maglev-code-generator.h",
      "src/maglev/maglev-compilation-info.h",
      "src/maglev/maglev-compilation-unit.h",
      "src/maglev/maglev-compiler.h",
      "src/maglev/maglev-concurrent-dispatcher.h",
      "src/maglev/maglev-graph-builder.h",
      "src/maglev/maglev-graph-labeller.h",
      "src/maglev/maglev-graph-printer.h",
      "src/maglev/maglev-graph-processor.h",
      "src/maglev/maglev-graph-verifier.h",
      "src/maglev/maglev-graph.h",
      "src/maglev/maglev-interpreter-frame-state.h",
      "src/maglev/maglev-ir-inl.h",
      "src/maglev/maglev-ir.h",
      "src/maglev/maglev-phi-representation-selector.h",
      "src/maglev/maglev-pipeline-statistics.h",
      "src/maglev/maglev-regalloc-data.h",
      "src/maglev/maglev-regalloc.h",
      "src/maglev/maglev-register-frame-array.h",
      "src/maglev/maglev.h",
    ]
    if (v8_current_cpu == "arm") {
      sources += [ "src/maglev/arm/maglev-assembler-arm-inl.h" ]
    } else if (v8_current_cpu == "arm64") {
      sources += [ "src/maglev/arm64/maglev-assembler-arm64-inl.h" ]
    } else if (v8_current_cpu == "x64") {
      sources += [ "src/maglev/x64/maglev-assembler-x64-inl.h" ]
    }
  }

  if (v8_enable_webassembly) {
    sources += [
      "src/asmjs/asm-js.h",
      "src/asmjs/asm-names.h",
      "src/asmjs/asm-parser.h",
      "src/asmjs/asm-scanner.h",
      "src/asmjs/asm-types.h",
      "src/compiler/int64-lowering.h",
      "src/compiler/turboshaft/int64-lowering-phase.h",
      "src/compiler/turboshaft/int64-lowering-reducer.h",
      "src/compiler/turboshaft/wasm-assembler-helpers.h",
      "src/compiler/turboshaft/wasm-gc-optimize-phase.h",
      "src/compiler/turboshaft/wasm-gc-typed-optimization-reducer.h",
      "src/compiler/turboshaft/wasm-js-lowering-reducer.h",
      "src/compiler/turboshaft/wasm-load-elimination-reducer.h",
      "src/compiler/turboshaft/wasm-lowering-phase.h",
      "src/compiler/turboshaft/wasm-lowering-reducer.h",
      "src/compiler/turboshaft/wasm-optimize-phase.h",
      "src/compiler/turboshaft/wasm-turboshaft-compiler.h",
      "src/compiler/wasm-address-reassociation.h",
      "src/compiler/wasm-call-descriptors.h",
      "src/compiler/wasm-compiler-definitions.h",
      "src/compiler/wasm-compiler.h",
      "src/compiler/wasm-escape-analysis.h",
      "src/compiler/wasm-gc-lowering.h",
      "src/compiler/wasm-gc-operator-reducer.h",
      "src/compiler/wasm-graph-assembler.h",
      "src/compiler/wasm-inlining-into-js.h",
      "src/compiler/wasm-inlining.h",
      "src/compiler/wasm-js-lowering.h",
      "src/compiler/wasm-load-elimination.h",
      "src/compiler/wasm-loop-peeling.h",
      "src/compiler/wasm-typer.h",
      "src/debug/debug-wasm-objects-inl.h",
      "src/debug/debug-wasm-objects.h",
      "src/third_party/utf8-decoder/generalized-utf8-decoder.h",
      "src/trap-handler/trap-handler-internal.h",
      "src/trap-handler/trap-handler.h",
      "src/wasm/baseline/liftoff-assembler-defs.h",
      "src/wasm/baseline/liftoff-assembler-inl.h",
      "src/wasm/baseline/liftoff-assembler.h",
      "src/wasm/baseline/liftoff-compiler.h",
      "src/wasm/baseline/liftoff-register.h",
      "src/wasm/baseline/parallel-move-inl.h",
      "src/wasm/baseline/parallel-move.h",
      "src/wasm/canonical-types.h",
      "src/wasm/code-space-access.h",
      "src/wasm/compilation-environment-inl.h",
      "src/wasm/compilation-environment.h",
      "src/wasm/constant-expression-interface.h",
      "src/wasm/constant-expression.h",
      "src/wasm/decoder.h",
      "src/wasm/function-body-decoder-impl.h",
      "src/wasm/function-body-decoder.h",
      "src/wasm/function-compiler.h",
      "src/wasm/fuzzing/random-module-generation.h",
      "src/wasm/graph-builder-interface.h",
      "src/wasm/inlining-tree.h",
      "src/wasm/jump-table-assembler.h",
      "src/wasm/leb-helper.h",
      "src/wasm/local-decl-encoder.h",
      "src/wasm/memory-tracing.h",
      "src/wasm/module-compiler.h",
      "src/wasm/module-decoder-impl.h",
      "src/wasm/module-decoder.h",
      "src/wasm/module-instantiate.h",
      "src/wasm/names-provider.h",
      "src/wasm/object-access.h",
      "src/wasm/pgo.h",
      "src/wasm/serialized-signature-inl.h",
      "src/wasm/simd-shuffle.h",
      "src/wasm/stacks.h",
      "src/wasm/std-object-sizes.h",
      "src/wasm/streaming-decoder.h",
      "src/wasm/string-builder-multiline.h",
      "src/wasm/string-builder.h",
      "src/wasm/struct-types.h",
      "src/wasm/turboshaft-graph-interface.h",
      "src/wasm/value-type.h",
      "src/wasm/wasm-arguments.h",
      "src/wasm/wasm-builtin-list.h",
      "src/wasm/wasm-code-manager.h",
      "src/wasm/wasm-debug.h",
      "src/wasm/wasm-disassembler-impl.h",
      "src/wasm/wasm-disassembler.h",
      "src/wasm/wasm-engine.h",
      "src/wasm/wasm-external-refs.h",
      "src/wasm/wasm-feature-flags.h",
      "src/wasm/wasm-features.h",
      "src/wasm/wasm-import-wrapper-cache.h",
      "src/wasm/wasm-init-expr.h",
      "src/wasm/wasm-js.h",
      "src/wasm/wasm-linkage.h",
      "src/wasm/wasm-module-builder.h",
      "src/wasm/wasm-module-sourcemap.h",
      "src/wasm/wasm-module.h",
      "src/wasm/wasm-objects-inl.h",
      "src/wasm/wasm-objects.h",
      "src/wasm/wasm-opcodes-inl.h",
      "src/wasm/wasm-opcodes.h",
      "src/wasm/wasm-result.h",
      "src/wasm/wasm-serialization.h",
      "src/wasm/wasm-subtyping.h",
      "src/wasm/wasm-tier.h",
      "src/wasm/wasm-value.h",
      "src/wasm/well-known-imports.h",
    ]
  }

  if (v8_enable_wasm_simd256_revec) {
    sources += [
      "src/compiler/linear-scheduler.h",
      "src/compiler/revectorizer.h",
      "src/compiler/turboshaft/wasm-revec-phase.h",
      "src/compiler/turboshaft/wasm-revec-reducer.h",
    ]
  }

  if (!v8_enable_third_party_heap) {
    sources += filter_include(v8_third_party_heap_files, [ "*.h" ])
  } else {
    sources += [ "src/heap/third-party/heap-api.h" ]
  }

  if (v8_enable_i18n_support) {
    sources += [
      "src/objects/intl-objects.h",
      "src/objects/js-break-iterator-inl.h",
      "src/objects/js-break-iterator.h",
      "src/objects/js-collator-inl.h",
      "src/objects/js-collator.h",
      "src/objects/js-date-time-format-inl.h",
      "src/objects/js-date-time-format.h",
      "src/objects/js-display-names-inl.h",
      "src/objects/js-display-names.h",
      "src/objects/js-duration-format-inl.h",
      "src/objects/js-duration-format.h",
      "src/objects/js-list-format-inl.h",
      "src/objects/js-list-format.h",
      "src/objects/js-locale-inl.h",
      "src/objects/js-locale.h",
      "src/objects/js-number-format-inl.h",
      "src/objects/js-number-format.h",
      "src/objects/js-plural-rules-inl.h",
      "src/objects/js-plural-rules.h",
      "src/objects/js-relative-time-format-inl.h",
      "src/objects/js-relative-time-format.h",
      "src/objects/js-segment-iterator-inl.h",
      "src/objects/js-segment-iterator.h",
      "src/objects/js-segmenter-inl.h",
      "src/objects/js-segmenter.h",
    ]
  }

  if (!v8_control_flow_integrity) {
    sources += [ "src/execution/pointer-authentication-dummy.h" ]
  }

  if (v8_enable_conservative_stack_scanning) {
    sources += [ "src/heap/conservative-stack-visitor.h" ]
  }

  if (v8_enable_wasm_gdb_remote_debugging) {
    sources += [
      "src/debug/wasm/gdb-server/gdb-remote-util.h",
      "src/debug/wasm/gdb-server/gdb-server-thread.h",
      "src/debug/wasm/gdb-server/gdb-server.h",
      "src/debug/wasm/gdb-server/packet.h",
      "src/debug/wasm/gdb-server/session.h",
      "src/debug/wasm/gdb-server/target.h",
      "src/debug/wasm/gdb-server/transport.h",
      "src/debug/wasm/gdb-server/wasm-module-debug.h",
    ]
  }

  if (v8_enable_heap_snapshot_verify) {
    sources += [ "src/heap/reference-summarizer.h" ]
  }

  if (v8_current_cpu == "x86") {
    sources += [
      ### gcmole(ia32) ###
      "src/baseline/ia32/baseline-assembler-ia32-inl.h",
      "src/baseline/ia32/baseline-compiler-ia32-inl.h",
      "src/codegen/ia32/assembler-ia32-inl.h",
      "src/codegen/ia32/assembler-ia32.h",
      "src/codegen/ia32/constants-ia32.h",
      "src/codegen/ia32/interface-descriptors-ia32-inl.h",
      "src/codegen/ia32/macro-assembler-ia32.h",
      "src/codegen/ia32/register-ia32.h",
      "src/codegen/ia32/reglist-ia32.h",
      "src/codegen/ia32/sse-instr.h",
      "src/codegen/shared-ia32-x64/macro-assembler-shared-ia32-x64.h",
      "src/compiler/backend/ia32/instruction-codes-ia32.h",
      "src/execution/ia32/frame-constants-ia32.h",
      "src/regexp/ia32/regexp-macro-assembler-ia32.h",
      "src/wasm/baseline/ia32/liftoff-assembler-ia32-inl.h",
    ]
    if (v8_enable_sparkplug) {
      sources += [
        "src/baseline/ia32/baseline-assembler-ia32-inl.h",
        "src/baseline/ia32/baseline-compiler-ia32-inl.h",
      ]
    }
  } else if (v8_current_cpu == "x64") {
    sources += [
      ### gcmole(x64) ###
      "src/codegen/shared-ia32-x64/macro-assembler-shared-ia32-x64.h",
      "src/codegen/x64/assembler-x64-inl.h",
      "src/codegen/x64/assembler-x64.h",
      "src/codegen/x64/constants-x64.h",
      "src/codegen/x64/fma-instr.h",
      "src/codegen/x64/interface-descriptors-x64-inl.h",
      "src/codegen/x64/macro-assembler-x64.h",
      "src/codegen/x64/register-x64.h",
      "src/codegen/x64/reglist-x64.h",
      "src/codegen/x64/sse-instr.h",
      "src/compiler/backend/x64/instruction-codes-x64.h",
      "src/compiler/backend/x64/unwinding-info-writer-x64.h",
      "src/execution/x64/frame-constants-x64.h",
      "src/regexp/x64/regexp-macro-assembler-x64.h",
      "src/third_party/valgrind/valgrind.h",
      "src/wasm/baseline/x64/liftoff-assembler-x64-inl.h",
    ]

    if (is_win) {
      sources += [ "src/diagnostics/unwinding-info-win64.h" ]
    }

    if (v8_enable_sparkplug) {
      sources += [
        "src/baseline/x64/baseline-assembler-x64-inl.h",
        "src/baseline/x64/baseline-compiler-x64-inl.h",
      ]
    }

    if (v8_enable_webassembly) {
      # iOS Xcode simulator builds run on an x64 target. iOS and macOS are both
      # based on Darwin and thus POSIX-compliant to a similar degree.
      if (is_linux || is_chromeos || is_mac || is_ios ||
          target_os == "freebsd") {
        sources += [ "src/trap-handler/handler-inside-posix.h" ]
      } else if (is_win) {
        sources += [ "src/trap-handler/handler-inside-win.h" ]
      }
    }
  } else if (v8_current_cpu == "arm") {
    sources += [
      ### gcmole(arm) ###
      "src/codegen/arm/assembler-arm-inl.h",
      "src/codegen/arm/assembler-arm.h",
      "src/codegen/arm/constants-arm.h",
      "src/codegen/arm/interface-descriptors-arm-inl.h",
      "src/codegen/arm/macro-assembler-arm.h",
      "src/codegen/arm/register-arm.h",
      "src/codegen/arm/reglist-arm.h",
      "src/compiler/backend/arm/instruction-codes-arm.h",
      "src/compiler/backend/arm/unwinding-info-writer-arm.h",
      "src/execution/arm/frame-constants-arm.h",
      "src/execution/arm/simulator-arm.h",
      "src/regexp/arm/regexp-macro-assembler-arm.h",
      "src/wasm/baseline/arm/liftoff-assembler-arm-inl.h",
    ]

    if (v8_enable_sparkplug) {
      sources += [
        "src/baseline/arm/baseline-assembler-arm-inl.h",
        "src/baseline/arm/baseline-compiler-arm-inl.h",
      ]
    }
  } else if (v8_current_cpu == "arm64") {
    sources += [
      ### gcmole(arm64) ###
      "src/codegen/arm64/assembler-arm64-inl.h",
      "src/codegen/arm64/assembler-arm64.h",
      "src/codegen/arm64/constants-arm64.h",
      "src/codegen/arm64/decoder-arm64-inl.h",
      "src/codegen/arm64/decoder-arm64.h",
      "src/codegen/arm64/instructions-arm64.h",
      "src/codegen/arm64/interface-descriptors-arm64-inl.h",
      "src/codegen/arm64/macro-assembler-arm64-inl.h",
      "src/codegen/arm64/macro-assembler-arm64.h",
      "src/codegen/arm64/register-arm64.h",
      "src/codegen/arm64/reglist-arm64.h",
      "src/codegen/arm64/utils-arm64.h",
      "src/compiler/backend/arm64/instruction-codes-arm64.h",
      "src/compiler/backend/arm64/unwinding-info-writer-arm64.h",
      "src/diagnostics/arm64/disasm-arm64.h",
      "src/execution/arm64/frame-constants-arm64.h",
      "src/execution/arm64/simulator-arm64.h",
      "src/regexp/arm64/regexp-macro-assembler-arm64.h",
      "src/wasm/baseline/arm64/liftoff-assembler-arm64-inl.h",
    ]
    if (v8_control_flow_integrity) {
      sources += [ "src/execution/arm64/pointer-authentication-arm64.h" ]
    }
    if (v8_enable_sparkplug) {
      sources += [
        "src/baseline/arm64/baseline-assembler-arm64-inl.h",
        "src/baseline/arm64/baseline-compiler-arm64-inl.h",
      ]
    }
    if (v8_enable_webassembly) {
      # Trap handling is enabled on arm64 Mac and Linux and in simulators on
      # x64 on Linux and Mac.
      if ((current_cpu == "arm64" &&
           (is_linux || is_chromeos || is_mac || is_ios)) ||
          (current_cpu == "x64" && (is_linux || is_chromeos || is_mac))) {
        sources += [ "src/trap-handler/handler-inside-posix.h" ]
      }
      if (current_cpu == "x64" &&
          (is_linux || is_chromeos || is_mac || is_win)) {
        sources += [ "src/trap-handler/trap-handler-simulator.h" ]
      }
    }
    if (is_win) {
      sources += [ "src/diagnostics/unwinding-info-win64.h" ]
    }
  } else if (v8_current_cpu == "mips64" || v8_current_cpu == "mips64el") {
    sources += [
      ### gcmole(mips64el) ###
      "src/codegen/mips64/assembler-mips64-inl.h",
      "src/codegen/mips64/assembler-mips64.h",
      "src/codegen/mips64/constants-mips64.h",
      "src/codegen/mips64/macro-assembler-mips64.h",
      "src/codegen/mips64/register-mips64.h",
      "src/codegen/mips64/reglist-mips64.h",
      "src/compiler/backend/mips64/instruction-codes-mips64.h",
      "src/execution/mips64/frame-constants-mips64.h",
      "src/execution/mips64/simulator-mips64.h",
      "src/regexp/mips64/regexp-macro-assembler-mips64.h",
      "src/wasm/baseline/mips64/liftoff-assembler-mips64-inl.h",
    ]
    if (v8_enable_sparkplug) {
      sources += [
        "src/baseline/mips64/baseline-assembler-mips64-inl.h",
        "src/baseline/mips64/baseline-compiler-mips64-inl.h",
      ]
    }
  } else if (v8_current_cpu == "loong64") {
    sources += [
      ### gcmole(loong64) ###
      "src/codegen/loong64/assembler-loong64-inl.h",
      "src/codegen/loong64/assembler-loong64.h",
      "src/codegen/loong64/constants-loong64.h",
      "src/codegen/loong64/macro-assembler-loong64.h",
      "src/codegen/loong64/register-loong64.h",
      "src/codegen/loong64/reglist-loong64.h",
      "src/compiler/backend/loong64/instruction-codes-loong64.h",
      "src/execution/loong64/frame-constants-loong64.h",
      "src/execution/loong64/simulator-loong64.h",
      "src/regexp/loong64/regexp-macro-assembler-loong64.h",
      "src/wasm/baseline/loong64/liftoff-assembler-loong64-inl.h",
    ]
    if (v8_enable_sparkplug) {
      sources += [
        "src/baseline/loong64/baseline-assembler-loong64-inl.h",
        "src/baseline/loong64/baseline-compiler-loong64-inl.h",
      ]
    }
    if (v8_enable_webassembly) {
      # Trap handling is enabled on loong64 Linux and in simulators on
      # x64 on Linux.
      if ((current_cpu == "loong64" && is_linux) ||
          (current_cpu == "x64" && is_linux)) {
        sources += [ "src/trap-handler/handler-inside-posix.h" ]
      }
      if (current_cpu == "x64" && is_linux) {
        sources += [ "src/trap-handler/trap-handler-simulator.h" ]
      }
    }
  } else if (v8_current_cpu == "ppc") {
    sources += [
      ### gcmole(ppc) ###
      "src/codegen/ppc/assembler-ppc-inl.h",
      "src/codegen/ppc/assembler-ppc.h",
      "src/codegen/ppc/constants-ppc.h",
      "src/codegen/ppc/interface-descriptors-ppc-inl.h",
      "src/codegen/ppc/macro-assembler-ppc.h",
      "src/codegen/ppc/register-ppc.h",
      "src/codegen/ppc/reglist-ppc.h",
      "src/compiler/backend/ppc/instruction-codes-ppc.h",
      "src/compiler/backend/ppc/unwinding-info-writer-ppc.h",
      "src/execution/ppc/frame-constants-ppc.h",
      "src/execution/ppc/simulator-ppc.h",
      "src/regexp/ppc/regexp-macro-assembler-ppc.h",
      "src/wasm/baseline/ppc/liftoff-assembler-ppc-inl.h",
    ]
  } else if (v8_current_cpu == "ppc64") {
    sources += [
      ### gcmole(ppc64) ###
      "src/codegen/ppc/assembler-ppc-inl.h",
      "src/codegen/ppc/assembler-ppc.h",
      "src/codegen/ppc/constants-ppc.h",
      "src/codegen/ppc/interface-descriptors-ppc-inl.h",
      "src/codegen/ppc/macro-assembler-ppc.h",
      "src/codegen/ppc/register-ppc.h",
      "src/codegen/ppc/reglist-ppc.h",
      "src/compiler/backend/ppc/instruction-codes-ppc.h",
      "src/compiler/backend/ppc/unwinding-info-writer-ppc.h",
      "src/execution/ppc/frame-constants-ppc.h",
      "src/execution/ppc/simulator-ppc.h",
      "src/regexp/ppc/regexp-macro-assembler-ppc.h",
      "src/wasm/baseline/ppc/liftoff-assembler-ppc-inl.h",
    ]
    if (v8_enable_sparkplug) {
      sources += [
        "src/baseline/ppc/baseline-assembler-ppc-inl.h",
        "src/baseline/ppc/baseline-compiler-ppc-inl.h",
      ]
    }
  } else if (v8_current_cpu == "s390" || v8_current_cpu == "s390x") {
    sources += [
      ### gcmole(s390) ###
      "src/codegen/s390/assembler-s390-inl.h",
      "src/codegen/s390/assembler-s390.h",
      "src/codegen/s390/constants-s390.h",
      "src/codegen/s390/interface-descriptors-s390-inl.h",
      "src/codegen/s390/macro-assembler-s390.h",
      "src/codegen/s390/register-s390.h",
      "src/codegen/s390/reglist-s390.h",
      "src/compiler/backend/s390/instruction-codes-s390.h",
      "src/compiler/backend/s390/unwinding-info-writer-s390.h",
      "src/execution/s390/frame-constants-s390.h",
      "src/execution/s390/simulator-s390.h",
      "src/regexp/s390/regexp-macro-assembler-s390.h",
      "src/wasm/baseline/s390/liftoff-assembler-s390-inl.h",
    ]
    if (v8_enable_sparkplug) {
      sources += [
        "src/baseline/s390/baseline-assembler-s390-inl.h",
        "src/baseline/s390/baseline-compiler-s390-inl.h",
      ]
    }
  } else if (v8_current_cpu == "riscv64") {
    sources += [
      ### gcmole(riscv64) ###
      "src/baseline/riscv/baseline-assembler-riscv-inl.h",
      "src/baseline/riscv/baseline-compiler-riscv-inl.h",
      "src/codegen/riscv/assembler-riscv-inl.h",
      "src/codegen/riscv/assembler-riscv.h",
      "src/codegen/riscv/base-assembler-riscv.h",
      "src/codegen/riscv/base-constants-riscv.h",
      "src/codegen/riscv/base-riscv-i.h",
      "src/codegen/riscv/constant-riscv-a.h",
      "src/codegen/riscv/constant-riscv-b.h",
      "src/codegen/riscv/constant-riscv-c.h",
      "src/codegen/riscv/constant-riscv-d.h",
      "src/codegen/riscv/constant-riscv-f.h",
      "src/codegen/riscv/constant-riscv-m.h",
      "src/codegen/riscv/constant-riscv-v.h",
      "src/codegen/riscv/constant-riscv-zicsr.h",
      "src/codegen/riscv/constant-riscv-zifencei.h",
      "src/codegen/riscv/constants-riscv.h",
      "src/codegen/riscv/extension-riscv-a.h",
      "src/codegen/riscv/extension-riscv-b.h",
      "src/codegen/riscv/extension-riscv-c.h",
      "src/codegen/riscv/extension-riscv-d.h",
      "src/codegen/riscv/extension-riscv-f.h",
      "src/codegen/riscv/extension-riscv-inl.h",
      "src/codegen/riscv/extension-riscv-m.h",
      "src/codegen/riscv/extension-riscv-v.h",
      "src/codegen/riscv/extension-riscv-zicsr.h",
      "src/codegen/riscv/extension-riscv-zifencei.h",
      "src/codegen/riscv/interface-descriptors-riscv-inl.h",
      "src/codegen/riscv/macro-assembler-riscv.h",
      "src/codegen/riscv/register-riscv.h",
      "src/codegen/riscv/reglist-riscv.h",
      "src/compiler/backend/riscv/instruction-codes-riscv.h",
      "src/execution/riscv/frame-constants-riscv.h",
      "src/execution/riscv/simulator-riscv.h",
      "src/regexp/riscv/regexp-macro-assembler-riscv.h",
      "src/wasm/baseline/riscv/liftoff-assembler-riscv64-inl.h",
    ]
    if (v8_enable_sparkplug) {
      sources += [
        "src/baseline/riscv/baseline-assembler-riscv-inl.h",
        "src/baseline/riscv/baseline-compiler-riscv-inl.h",
      ]
    }
    if (v8_enable_webassembly) {
      # Trap handling is enabled on riscv64 Linux and in simulators on
      # x64 on Linux.
      if ((current_cpu == "riscv64" && is_linux) ||
          (current_cpu == "x64" && is_linux)) {
        sources += [ "src/trap-handler/handler-inside-posix.h" ]
      }
      if (current_cpu == "x64" && is_linux) {
        sources += [ "src/trap-handler/trap-handler-simulator.h" ]
      }
    }
  } else if (v8_current_cpu == "riscv32") {
    sources += [
      ### gcmole(riscv32) ###
      "src/codegen/riscv/assembler-riscv-inl.h",
      "src/codegen/riscv/assembler-riscv.h",
      "src/codegen/riscv/base-assembler-riscv.h",
      "src/codegen/riscv/base-constants-riscv.h",
      "src/codegen/riscv/base-riscv-i.h",
      "src/codegen/riscv/constant-riscv-a.h",
      "src/codegen/riscv/constant-riscv-b.h",
      "src/codegen/riscv/constant-riscv-c.h",
      "src/codegen/riscv/constant-riscv-d.h",
      "src/codegen/riscv/constant-riscv-f.h",
      "src/codegen/riscv/constant-riscv-i.h",
      "src/codegen/riscv/constant-riscv-m.h",
      "src/codegen/riscv/constant-riscv-v.h",
      "src/codegen/riscv/constant-riscv-zicsr.h",
      "src/codegen/riscv/constant-riscv-zifencei.h",
      "src/codegen/riscv/constants-riscv.h",
      "src/codegen/riscv/extension-riscv-a.h",
      "src/codegen/riscv/extension-riscv-b.h",
      "src/codegen/riscv/extension-riscv-c.h",
      "src/codegen/riscv/extension-riscv-d.h",
      "src/codegen/riscv/extension-riscv-f.h",
      "src/codegen/riscv/extension-riscv-inl.h",
      "src/codegen/riscv/extension-riscv-m.h",
      "src/codegen/riscv/extension-riscv-v.h",
      "src/codegen/riscv/extension-riscv-zicsr.h",
      "src/codegen/riscv/extension-riscv-zifencei.h",
      "src/codegen/riscv/interface-descriptors-riscv-inl.h",
      "src/codegen/riscv/macro-assembler-riscv.h",
      "src/codegen/riscv/register-riscv.h",
      "src/codegen/riscv/reglist-riscv.h",
      "src/compiler/backend/riscv/instruction-codes-riscv.h",
      "src/execution/riscv/frame-constants-riscv.h",
      "src/execution/riscv/simulator-riscv.h",
      "src/regexp/riscv/regexp-macro-assembler-riscv.h",
      "src/wasm/baseline/riscv32/liftoff-assembler-riscv32-inl.h",
    ]
    if (v8_enable_sparkplug) {
      sources += [
        "src/baseline/riscv/baseline-assembler-riscv-inl.h",
        "src/baseline/riscv/baseline-compiler-riscv-inl.h",
      ]
    }
  }

  public_deps = [
    ":torque_runtime_support",
    ":v8_flags",
    ":v8_headers",
    ":v8_maybe_icu",
    ":v8_shared_internal_headers",
    "//third_party/fp16",
  ]

  deps = [
    ":cppgc_headers",
    ":generate_bytecode_builtins_list",
    ":run_torque",
    ":v8_abseil",
    ":v8_heap_base_headers",
    ":v8_libbase",
  ]
}

v8_compiler_sources = [
  ### gcmole(all) ###
  "src/compiler/access-builder.cc",
  "src/compiler/access-info.cc",
  "src/compiler/add-type-assertions-reducer.cc",
  "src/compiler/all-nodes.cc",
  "src/compiler/backend/bitcast-elider.cc",
  "src/compiler/backend/code-generator.cc",
  "src/compiler/backend/frame-elider.cc",
  "src/compiler/backend/gap-resolver.cc",
  "src/compiler/backend/instruction-scheduler.cc",
  "src/compiler/backend/instruction-selector.cc",
  "src/compiler/backend/instruction.cc",
  "src/compiler/backend/jump-threading.cc",
  "src/compiler/backend/move-optimizer.cc",
  "src/compiler/backend/register-allocator-verifier.cc",
  "src/compiler/backend/register-allocator.cc",
  "src/compiler/backend/spill-placer.cc",
  "src/compiler/basic-block-instrumentor.cc",
  "src/compiler/branch-condition-duplicator.cc",
  "src/compiler/branch-elimination.cc",
  "src/compiler/bytecode-analysis.cc",
  "src/compiler/bytecode-graph-builder.cc",
  "src/compiler/bytecode-liveness-map.cc",
  "src/compiler/c-linkage.cc",
  "src/compiler/checkpoint-elimination.cc",
  "src/compiler/code-assembler.cc",
  "src/compiler/common-node-cache.cc",
  "src/compiler/common-operator-reducer.cc",
  "src/compiler/common-operator.cc",
  "src/compiler/compilation-dependencies.cc",
  "src/compiler/compiler-source-position-table.cc",
  "src/compiler/const-tracking-let-helpers.cc",
  "src/compiler/constant-folding-reducer.cc",
  "src/compiler/control-equivalence.cc",
  "src/compiler/control-flow-optimizer.cc",
  "src/compiler/csa-load-elimination.cc",
  "src/compiler/dead-code-elimination.cc",
  "src/compiler/decompression-optimizer.cc",
  "src/compiler/effect-control-linearizer.cc",
  "src/compiler/escape-analysis-reducer.cc",
  "src/compiler/escape-analysis.cc",
  "src/compiler/fast-api-calls.cc",
  "src/compiler/feedback-source.cc",
  "src/compiler/frame-states.cc",
  "src/compiler/frame.cc",
  "src/compiler/graph-assembler.cc",
  "src/compiler/graph-reducer.cc",
  "src/compiler/graph-trimmer.cc",
  "src/compiler/graph-visualizer.cc",
  "src/compiler/graph.cc",
  "src/compiler/heap-refs.cc",
  "src/compiler/js-call-reducer.cc",
  "src/compiler/js-context-specialization.cc",
  "src/compiler/js-create-lowering.cc",
  "src/compiler/js-generic-lowering.cc",
  "src/compiler/js-graph.cc",
  "src/compiler/js-heap-broker.cc",
  "src/compiler/js-inlining-heuristic.cc",
  "src/compiler/js-inlining.cc",
  "src/compiler/js-intrinsic-lowering.cc",
  "src/compiler/js-native-context-specialization.cc",
  "src/compiler/js-operator.cc",
  "src/compiler/js-type-hint-lowering.cc",
  "src/compiler/js-typed-lowering.cc",
  "src/compiler/late-escape-analysis.cc",
  "src/compiler/linkage.cc",
  "src/compiler/load-elimination.cc",
  "src/compiler/loop-analysis.cc",
  "src/compiler/loop-peeling.cc",
  "src/compiler/loop-unrolling.cc",
  "src/compiler/loop-variable-optimizer.cc",
  "src/compiler/machine-graph-verifier.cc",
  "src/compiler/machine-graph.cc",
  "src/compiler/machine-operator-reducer.cc",
  "src/compiler/machine-operator.cc",
  "src/compiler/map-inference.cc",
  "src/compiler/memory-lowering.cc",
  "src/compiler/memory-optimizer.cc",
  "src/compiler/node-marker.cc",
  "src/compiler/node-matchers.cc",
  "src/compiler/node-observer.cc",
  "src/compiler/node-origin-table.cc",
  "src/compiler/node-properties.cc",
  "src/compiler/node.cc",
  "src/compiler/opcodes.cc",
  "src/compiler/operation-typer.cc",
  "src/compiler/operator-properties.cc",
  "src/compiler/operator.cc",
  "src/compiler/osr.cc",
  "src/compiler/pair-load-store-reducer.cc",
  "src/compiler/pipeline-statistics.cc",
  "src/compiler/pipeline.cc",
  "src/compiler/property-access-builder.cc",
  "src/compiler/raw-machine-assembler.cc",
  "src/compiler/redundancy-elimination.cc",
  "src/compiler/refs-map.cc",
  "src/compiler/representation-change.cc",
  "src/compiler/schedule.cc",
  "src/compiler/scheduler.cc",
  "src/compiler/select-lowering.cc",
  "src/compiler/simplified-lowering-verifier.cc",
  "src/compiler/simplified-lowering.cc",
  "src/compiler/simplified-operator-reducer.cc",
  "src/compiler/simplified-operator.cc",
  "src/compiler/state-values-utils.cc",
  "src/compiler/store-store-elimination.cc",
  "src/compiler/string-builder-optimizer.cc",
  "src/compiler/turbofan-enabled.cc",
  "src/compiler/type-cache.cc",
  "src/compiler/type-narrowing-reducer.cc",
  "src/compiler/typed-optimization.cc",
  "src/compiler/typer.cc",
  "src/compiler/types.cc",
  "src/compiler/value-numbering-reducer.cc",
  "src/compiler/verifier.cc",
  "src/compiler/zone-stats.cc",
]

if (v8_current_cpu == "x86") {
  v8_compiler_sources += [
    ### gcmole(ia32) ###
    "src/compiler/backend/ia32/code-generator-ia32.cc",
    "src/compiler/backend/ia32/instruction-scheduler-ia32.cc",
    "src/compiler/backend/ia32/instruction-selector-ia32.cc",
  ]
} else if (v8_current_cpu == "x64") {
  v8_compiler_sources += [
    ### gcmole(x64) ###
    "src/compiler/backend/x64/code-generator-x64.cc",
    "src/compiler/backend/x64/instruction-scheduler-x64.cc",
    "src/compiler/backend/x64/instruction-selector-x64.cc",
    "src/compiler/backend/x64/unwinding-info-writer-x64.cc",
  ]
} else if (v8_current_cpu == "arm") {
  v8_compiler_sources += [
    ### gcmole(arm) ###
    "src/compiler/backend/arm/code-generator-arm.cc",
    "src/compiler/backend/arm/instruction-scheduler-arm.cc",
    "src/compiler/backend/arm/instruction-selector-arm.cc",
    "src/compiler/backend/arm/unwinding-info-writer-arm.cc",
  ]
} else if (v8_current_cpu == "arm64") {
  v8_compiler_sources += [
    ### gcmole(arm64) ###
    "src/compiler/backend/arm64/code-generator-arm64.cc",
    "src/compiler/backend/arm64/instruction-scheduler-arm64.cc",
    "src/compiler/backend/arm64/instruction-selector-arm64.cc",
    "src/compiler/backend/arm64/unwinding-info-writer-arm64.cc",
  ]
} else if (v8_current_cpu == "mips64" || v8_current_cpu == "mips64el") {
  v8_compiler_sources += [
    ### gcmole(mips64el) ###
    "src/compiler/backend/mips64/code-generator-mips64.cc",
    "src/compiler/backend/mips64/instruction-scheduler-mips64.cc",
    "src/compiler/backend/mips64/instruction-selector-mips64.cc",
  ]
} else if (v8_current_cpu == "loong64") {
  v8_compiler_sources += [
    ### gcmole(loong64) ###
    "src/compiler/backend/loong64/code-generator-loong64.cc",
    "src/compiler/backend/loong64/instruction-scheduler-loong64.cc",
    "src/compiler/backend/loong64/instruction-selector-loong64.cc",
  ]
} else if (v8_current_cpu == "ppc") {
  v8_compiler_sources += [
    ### gcmole(ppc) ###
    "src/compiler/backend/ppc/code-generator-ppc.cc",
    "src/compiler/backend/ppc/instruction-scheduler-ppc.cc",
    "src/compiler/backend/ppc/instruction-selector-ppc.cc",
    "src/compiler/backend/ppc/unwinding-info-writer-ppc.cc",
  ]
} else if (v8_current_cpu == "ppc64") {
  v8_compiler_sources += [
    ### gcmole(ppc64) ###
    "src/compiler/backend/ppc/code-generator-ppc.cc",
    "src/compiler/backend/ppc/instruction-scheduler-ppc.cc",
    "src/compiler/backend/ppc/instruction-selector-ppc.cc",
    "src/compiler/backend/ppc/unwinding-info-writer-ppc.cc",
  ]
} else if (v8_current_cpu == "s390" || v8_current_cpu == "s390x") {
  v8_compiler_sources += [
    ### gcmole(s390) ###
    "src/compiler/backend/s390/code-generator-s390.cc",
    "src/compiler/backend/s390/instruction-scheduler-s390.cc",
    "src/compiler/backend/s390/instruction-selector-s390.cc",
    "src/compiler/backend/s390/unwinding-info-writer-s390.cc",
  ]
} else if (v8_current_cpu == "riscv64") {
  v8_compiler_sources += [
    ### gcmole(riscv64) ###
    "src/compiler/backend/riscv/code-generator-riscv.cc",
    "src/compiler/backend/riscv/instruction-scheduler-riscv.cc",
    "src/compiler/backend/riscv/instruction-selector-riscv64.cc",
  ]
} else if (v8_current_cpu == "riscv32") {
  v8_compiler_sources += [
    ### gcmole(riscv32) ###
    "src/compiler/backend/riscv/code-generator-riscv.cc",
    "src/compiler/backend/riscv/instruction-scheduler-riscv.cc",
    "src/compiler/backend/riscv/instruction-selector-riscv32.cc",
  ]
}

if (v8_enable_webassembly) {
  v8_compiler_sources += [
    "src/compiler/int64-lowering.cc",
    "src/compiler/turboshaft/int64-lowering-phase.cc",
    "src/compiler/turboshaft/wasm-gc-optimize-phase.cc",
    "src/compiler/turboshaft/wasm-gc-typed-optimization-reducer.cc",
    "src/compiler/turboshaft/wasm-lowering-phase.cc",
    "src/compiler/turboshaft/wasm-optimize-phase.cc",
    "src/compiler/turboshaft/wasm-turboshaft-compiler.cc",
    "src/compiler/wasm-address-reassociation.cc",
    "src/compiler/wasm-call-descriptors.cc",
    "src/compiler/wasm-compiler-definitions.cc",
    "src/compiler/wasm-compiler.cc",
    "src/compiler/wasm-escape-analysis.cc",
    "src/compiler/wasm-gc-lowering.cc",
    "src/compiler/wasm-gc-operator-reducer.cc",
    "src/compiler/wasm-graph-assembler.cc",
    "src/compiler/wasm-inlining-into-js.cc",
    "src/compiler/wasm-inlining.cc",
    "src/compiler/wasm-js-lowering.cc",
    "src/compiler/wasm-load-elimination.cc",
    "src/compiler/wasm-loop-peeling.cc",
    "src/compiler/wasm-typer.cc",
  ]
}

if (v8_enable_wasm_simd256_revec) {
  v8_compiler_sources += [
    "src/compiler/linear-scheduler.cc",
    "src/compiler/revectorizer.cc",
    "src/compiler/turboshaft/wasm-revec-phase.cc",
    "src/compiler/turboshaft/wasm-revec-reducer.cc",
  ]
}

# The src/compiler files for use in mksnapshot.
# - These might be built with additional optimizations if
#   v8_enable_fast_mksnapshot is set.
# - We always include Turbofan even if v8_enable_turbofan is unset s.t.
#   builtins can be generated by mksnapshot.
v8_source_set("v8_compiler_for_mksnapshot_source_set") {
  visibility = [ ":*" ]  # Only targets in this file can depend on this.

  sources = v8_compiler_sources

  public_deps = [
    ":generate_bytecode_builtins_list",
    ":run_torque",
    ":v8_abseil",
    ":v8_maybe_icu",
    ":v8_tracing",
  ]

  deps = [
    ":v8_base_without_compiler",
    ":v8_internal_headers",
    ":v8_libbase",
    ":v8_shared_internal_headers",
  ]

  if (is_debug && !v8_optimized_debug && v8_enable_fast_mksnapshot) {
    # The :no_optimize config is added to v8_add_configs in v8.gni.
    remove_configs = [ "//build/config/compiler:no_optimize" ]
    configs = [ ":always_turbofanimize" ]
  } else {
    # Without this else branch, gn fails to generate build files for non-debug
    # builds (because we try to remove a config that is not present).
    # So we include it, even if this config is not used outside of debug builds.
    configs = [ ":internal_config" ]
  }
}

# The src/compiler files with default behavior.
v8_source_set("v8_compiler") {
  visibility = [ ":*" ]  # Only targets in this file can depend on this.

  if (v8_enable_turbofan) {
    sources = v8_compiler_sources
  } else {
    # With Turbofan disabled, we only include the stubbed-out API.
    sources = [ "src/compiler/turbofan-disabled.cc" ]
  }

  public_deps = [
    ":generate_bytecode_builtins_list",
    ":run_torque",
    ":v8_abseil",
    ":v8_internal_headers",
    ":v8_maybe_icu",
    ":v8_tracing",
  ]

  deps = [
    ":v8_base_without_compiler",
    ":v8_libbase",
    ":v8_shared_internal_headers",
  ]

  configs = [ ":internal_config" ]
}

# The src/compiler files with default optimization behavior.
v8_source_set("v8_turboshaft") {
  visibility = [ ":*" ]  # Only targets in this file can depend on this.

  sources = [
    "src/compiler/turboshaft/analyzer-iterator.cc",
    "src/compiler/turboshaft/assembler.cc",
    "src/compiler/turboshaft/build-graph-phase.cc",
    "src/compiler/turboshaft/code-elimination-and-simplification-phase.cc",
    "src/compiler/turboshaft/copying-phase.cc",
    "src/compiler/turboshaft/csa-optimize-phase.cc",
    "src/compiler/turboshaft/debug-feature-lowering-phase.cc",
    "src/compiler/turboshaft/decompression-optimization-phase.cc",
    "src/compiler/turboshaft/decompression-optimization.cc",
    "src/compiler/turboshaft/graph-builder.cc",
    "src/compiler/turboshaft/graph-visualizer.cc",
    "src/compiler/turboshaft/graph.cc",
    "src/compiler/turboshaft/instruction-selection-phase.cc",
    "src/compiler/turboshaft/late-escape-analysis-reducer.cc",
    "src/compiler/turboshaft/late-load-elimination-reducer.cc",
    "src/compiler/turboshaft/loop-finder.cc",
    "src/compiler/turboshaft/loop-peeling-phase.cc",
    "src/compiler/turboshaft/loop-unrolling-phase.cc",
    "src/compiler/turboshaft/loop-unrolling-reducer.cc",
    "src/compiler/turboshaft/machine-lowering-phase.cc",
    "src/compiler/turboshaft/maglev-graph-building-phase.cc",
    "src/compiler/turboshaft/memory-optimization-reducer.cc",
    "src/compiler/turboshaft/operations.cc",
    "src/compiler/turboshaft/optimize-phase.cc",
    "src/compiler/turboshaft/phase.cc",
    "src/compiler/turboshaft/pretenuring-propagation-reducer.cc",
    "src/compiler/turboshaft/recreate-schedule-phase.cc",
    "src/compiler/turboshaft/recreate-schedule.cc",
    "src/compiler/turboshaft/representations.cc",
    "src/compiler/turboshaft/sidetable.cc",
    "src/compiler/turboshaft/simplified-lowering-phase.cc",
    "src/compiler/turboshaft/simplify-tf-loops.cc",
    "src/compiler/turboshaft/store-store-elimination-phase.cc",
    "src/compiler/turboshaft/type-assertions-phase.cc",
    "src/compiler/turboshaft/type-parser.cc",
    "src/compiler/turboshaft/typed-optimizations-phase.cc",
    "src/compiler/turboshaft/typer.cc",
    "src/compiler/turboshaft/types.cc",
    "src/compiler/turboshaft/use-map.cc",
    "src/compiler/turboshaft/utils.cc",
  ]

  if (!v8_enable_maglev) {
    # When Maglev is not enabled, Turboshaft still needs Maglev's graph builder.
    sources += [
      "src/maglev/maglev-compilation-info.cc",
      "src/maglev/maglev-compilation-unit.cc",
      "src/maglev/maglev-graph-builder.cc",
      "src/maglev/maglev-graph-printer.cc",
      "src/maglev/maglev-interpreter-frame-state.cc",
      "src/maglev/maglev-ir.cc",
    ]
  }

  public_deps = [
    ":generate_bytecode_builtins_list",
    ":run_torque",
    ":v8_internal_headers",
    ":v8_maybe_icu",
    ":v8_tracing",
  ]

  deps = [
    ":v8_base_without_compiler",
    ":v8_libbase",
    ":v8_shared_internal_headers",
  ]

  configs = [ ":internal_config" ]
}

group("v8_compiler_for_mksnapshot") {
  if ((is_debug && !v8_optimized_debug && v8_enable_fast_mksnapshot) ||
      !v8_enable_turbofan) {
    # mksnapshot needs its own version of the compiler, either because
    # a) we're optimizing for mksnapshot execution speed and the compiler
    #    should be optimized even if the rest of V8 is not; or
    # b) Turbofan is disabled and thus not compiled into the rest of V8, yet
    #    mksnapshot still needs TF to generate builtins.
    deps = [ ":v8_compiler_for_mksnapshot_source_set" ]
  } else {
    deps = [ ":v8_compiler" ]
  }
}

# Any target using trace events must directly or indirectly depend on
# v8_tracing.
group("v8_tracing") {
  if (v8_use_perfetto) {
    if (build_with_chromium) {
      public_deps = [ "//third_party/perfetto:libperfetto" ]
    } else {
      public_deps = [ ":v8_libperfetto" ]
    }
  }
}

v8_source_set("v8_base_without_compiler") {
  # Only targets in this file and gcmole can depend on this.
  visibility = [
    ":*",
    "tools/gcmole/:*",
  ]

  # Split static libraries on windows into two.
  split_count = 2

  sources = [
    ### gcmole(all) ###
    "src/api/api-arguments.cc",
    "src/api/api-natives.cc",
    "src/api/api.cc",
    "src/ast/ast-function-literal-id-reindexer.cc",
    "src/ast/ast-value-factory.cc",
    "src/ast/ast.cc",
    "src/ast/modules.cc",
    "src/ast/prettyprinter.cc",
    "src/ast/scopes.cc",
    "src/ast/source-range-ast-visitor.cc",
    "src/ast/variables.cc",
    "src/baseline/baseline.cc",
    "src/baseline/bytecode-offset-iterator.cc",
    "src/builtins/accessors.cc",
    "src/builtins/builtins-api.cc",
    "src/builtins/builtins-array.cc",
    "src/builtins/builtins-arraybuffer.cc",
    "src/builtins/builtins-async-module.cc",
    "src/builtins/builtins-atomics-synchronization.cc",
    "src/builtins/builtins-bigint.cc",
    "src/builtins/builtins-callsite.cc",
    "src/builtins/builtins-collections.cc",
    "src/builtins/builtins-console.cc",
    "src/builtins/builtins-dataview.cc",
    "src/builtins/builtins-date.cc",
    "src/builtins/builtins-error.cc",
    "src/builtins/builtins-function.cc",
    "src/builtins/builtins-global.cc",
    "src/builtins/builtins-internal.cc",
    "src/builtins/builtins-intl.cc",
    "src/builtins/builtins-json.cc",
    "src/builtins/builtins-number.cc",
    "src/builtins/builtins-object.cc",
    "src/builtins/builtins-reflect.cc",
    "src/builtins/builtins-regexp.cc",
    "src/builtins/builtins-shadow-realm.cc",
    "src/builtins/builtins-shared-array.cc",
    "src/builtins/builtins-sharedarraybuffer.cc",
    "src/builtins/builtins-string.cc",
    "src/builtins/builtins-struct.cc",
    "src/builtins/builtins-symbol.cc",
    "src/builtins/builtins-temporal.cc",
    "src/builtins/builtins-trace.cc",
    "src/builtins/builtins-typed-array.cc",
    "src/builtins/builtins-weak-refs.cc",
    "src/builtins/builtins.cc",
    "src/builtins/constants-table-builder.cc",
    "src/codegen/aligned-slot-allocator.cc",
    "src/codegen/assembler.cc",
    "src/codegen/bailout-reason.cc",
    "src/codegen/code-comments.cc",
    "src/codegen/code-desc.cc",
    "src/codegen/code-factory.cc",
    "src/codegen/code-reference.cc",
    "src/codegen/compilation-cache.cc",
    "src/codegen/compiler.cc",
    "src/codegen/constant-pool.cc",
    "src/codegen/external-reference-encoder.cc",
    "src/codegen/external-reference-table.cc",
    "src/codegen/external-reference.cc",
    "src/codegen/flush-instruction-cache.cc",
    "src/codegen/handler-table.cc",
    "src/codegen/interface-descriptors.cc",
    "src/codegen/machine-type.cc",
    "src/codegen/macro-assembler-base.cc",
    "src/codegen/maglev-safepoint-table.cc",
    "src/codegen/optimized-compilation-info.cc",
    "src/codegen/pending-optimization-table.cc",
    "src/codegen/register-configuration.cc",
    "src/codegen/reloc-info.cc",
    "src/codegen/safepoint-table.cc",
    "src/codegen/source-position-table.cc",
    "src/codegen/source-position.cc",
    "src/codegen/tick-counter.cc",
    "src/codegen/tnode.cc",
    "src/codegen/unoptimized-compilation-info.cc",
    "src/common/assert-scope.cc",
    "src/common/code-memory-access.cc",
    "src/common/ptr-compr.cc",
    "src/compiler-dispatcher/lazy-compile-dispatcher.cc",
    "src/compiler-dispatcher/optimizing-compile-dispatcher.cc",
    "src/date/date.cc",
    "src/date/dateparser.cc",
    "src/debug/debug-coverage.cc",
    "src/debug/debug-evaluate.cc",
    "src/debug/debug-frames.cc",
    "src/debug/debug-interface.cc",
    "src/debug/debug-property-iterator.cc",
    "src/debug/debug-scope-iterator.cc",
    "src/debug/debug-scopes.cc",
    "src/debug/debug-stack-trace-iterator.cc",
    "src/debug/debug.cc",
    "src/debug/liveedit-diff.cc",
    "src/debug/liveedit.cc",
    "src/deoptimizer/deoptimize-reason.cc",
    "src/deoptimizer/deoptimized-frame-info.cc",
    "src/deoptimizer/deoptimizer.cc",
    "src/deoptimizer/frame-translation-builder.cc",
    "src/deoptimizer/materialized-object-store.cc",
    "src/deoptimizer/translated-state.cc",
    "src/diagnostics/basic-block-profiler.cc",
    "src/diagnostics/compilation-statistics.cc",
    "src/diagnostics/disassembler.cc",
    "src/diagnostics/eh-frame.cc",
    "src/diagnostics/gdb-jit.cc",
    "src/diagnostics/objects-debug.cc",
    "src/diagnostics/objects-printer.cc",
    "src/diagnostics/perf-jit.cc",
    "src/diagnostics/unwinder.cc",
    "src/execution/arguments.cc",
    "src/execution/clobber-registers.cc",
    "src/execution/embedder-state.cc",
    "src/execution/encoded-c-signature.cc",
    "src/execution/execution.cc",
    "src/execution/frames.cc",
    "src/execution/futex-emulation.cc",
    "src/execution/interrupts-scope.cc",
    "src/execution/isolate.cc",
    "src/execution/local-isolate.cc",
    "src/execution/messages.cc",
    "src/execution/microtask-queue.cc",
    "src/execution/protectors.cc",
    "src/execution/simulator-base.cc",
    "src/execution/stack-guard.cc",
    "src/execution/thread-id.cc",
    "src/execution/thread-local-top.cc",
    "src/execution/tiering-manager.cc",
    "src/execution/v8threads.cc",
    "src/extensions/cputracemark-extension.cc",
    "src/extensions/externalize-string-extension.cc",
    "src/extensions/gc-extension.cc",
    "src/extensions/ignition-statistics-extension.cc",
    "src/extensions/statistics-extension.cc",
    "src/extensions/trigger-failure-extension.cc",
    "src/flags/flags.cc",
    "src/handles/global-handles.cc",
    "src/handles/handles.cc",
    "src/handles/local-handles.cc",
    "src/handles/persistent-handles.cc",
    "src/handles/shared-object-conveyor-handles.cc",
    "src/handles/traced-handles.cc",
    "src/heap/allocation-observer.cc",
    "src/heap/array-buffer-sweeper.cc",
    "src/heap/code-range.cc",
    "src/heap/code-stats.cc",
    "src/heap/collection-barrier.cc",
    "src/heap/combined-heap.cc",
    "src/heap/concurrent-marking.cc",
    "src/heap/cppgc-js/cpp-heap.cc",
    "src/heap/cppgc-js/cpp-snapshot.cc",
    "src/heap/cppgc-js/cross-heap-remembered-set.cc",
    "src/heap/cppgc-js/unified-heap-marking-state.cc",
    "src/heap/cppgc-js/unified-heap-marking-verifier.cc",
    "src/heap/cppgc-js/unified-heap-marking-visitor.cc",
    "src/heap/ephemeron-remembered-set.cc",
    "src/heap/evacuation-allocator.cc",
    "src/heap/evacuation-verifier.cc",
    "src/heap/factory-base.cc",
    "src/heap/factory.cc",
    "src/heap/finalization-registry-cleanup-task.cc",
    "src/heap/free-list.cc",
    "src/heap/gc-idle-time-handler.cc",
    "src/heap/gc-tracer.cc",
    "src/heap/heap-allocator.cc",
    "src/heap/heap-controller.cc",
    "src/heap/heap-layout-tracer.cc",
    "src/heap/heap-verifier.cc",
    "src/heap/heap-write-barrier.cc",
    "src/heap/heap.cc",
    "src/heap/incremental-marking-job.cc",
    "src/heap/incremental-marking.cc",
    "src/heap/index-generator.cc",
    "src/heap/large-page.cc",
    "src/heap/large-spaces.cc",
    "src/heap/local-factory.cc",
    "src/heap/local-heap.cc",
    "src/heap/main-allocator.cc",
    "src/heap/mark-compact.cc",
    "src/heap/mark-sweep-utilities.cc",
    "src/heap/marking-barrier.cc",
    "src/heap/marking-worklist.cc",
    "src/heap/marking.cc",
    "src/heap/memory-allocator.cc",
    "src/heap/memory-balancer.cc",
    "src/heap/memory-chunk-layout.cc",
    "src/heap/memory-chunk-metadata.cc",
    "src/heap/memory-chunk.cc",
    "src/heap/memory-measurement.cc",
    "src/heap/memory-reducer.cc",
    "src/heap/minor-gc-job.cc",
    "src/heap/minor-mark-sweep.cc",
    "src/heap/mutable-page.cc",
    "src/heap/new-spaces.cc",
    "src/heap/object-stats.cc",
    "src/heap/objects-visiting.cc",
    "src/heap/page.cc",
    "src/heap/paged-spaces.cc",
    "src/heap/pretenuring-handler.cc",
    "src/heap/read-only-heap.cc",
    "src/heap/read-only-promotion.cc",
    "src/heap/read-only-spaces.cc",
    "src/heap/safepoint.cc",
    "src/heap/scavenger.cc",
    "src/heap/slot-set.cc",
    "src/heap/spaces.cc",
    "src/heap/stress-scavenge-observer.cc",
    "src/heap/sweeper.cc",
    "src/heap/traced-handles-marking-visitor.cc",
    "src/heap/trusted-range.cc",
    "src/heap/weak-object-worklists.cc",
    "src/heap/zapping.cc",
    "src/ic/call-optimization.cc",
    "src/ic/handler-configuration.cc",
    "src/ic/ic-stats.cc",
    "src/ic/ic.cc",
    "src/ic/stub-cache.cc",
    "src/init/bootstrapper.cc",
    "src/init/icu_util.cc",
    "src/init/isolate-allocator.cc",
    "src/init/startup-data-util.cc",
    "src/init/v8.cc",
    "src/interpreter/bytecode-array-builder.cc",
    "src/interpreter/bytecode-array-iterator.cc",
    "src/interpreter/bytecode-array-random-iterator.cc",
    "src/interpreter/bytecode-array-writer.cc",
    "src/interpreter/bytecode-decoder.cc",
    "src/interpreter/bytecode-flags.cc",
    "src/interpreter/bytecode-generator.cc",
    "src/interpreter/bytecode-label.cc",
    "src/interpreter/bytecode-node.cc",
    "src/interpreter/bytecode-operands.cc",
    "src/interpreter/bytecode-register-optimizer.cc",
    "src/interpreter/bytecode-register.cc",
    "src/interpreter/bytecode-source-info.cc",
    "src/interpreter/bytecodes.cc",
    "src/interpreter/constant-array-builder.cc",
    "src/interpreter/control-flow-builders.cc",
    "src/interpreter/handler-table-builder.cc",
    "src/interpreter/interpreter-intrinsics.cc",
    "src/interpreter/interpreter.cc",
    "src/json/json-parser.cc",
    "src/json/json-stringifier.cc",
    "src/libsampler/sampler.cc",
    "src/logging/counters.cc",
    "src/logging/local-logger.cc",
    "src/logging/log-file.cc",
    "src/logging/log.cc",
    "src/logging/metrics.cc",
    "src/logging/runtime-call-stats.cc",
    "src/logging/tracing-flags.cc",
    "src/numbers/conversions.cc",
    "src/numbers/math-random.cc",
    "src/objects/abstract-code.cc",
    "src/objects/backing-store.cc",
    "src/objects/bigint.cc",
    "src/objects/bytecode-array.cc",
    "src/objects/call-site-info.cc",
    "src/objects/code-kind.cc",
    "src/objects/code.cc",
    "src/objects/compilation-cache-table.cc",
    "src/objects/contexts.cc",
    "src/objects/debug-objects.cc",
    "src/objects/deoptimization-data.cc",
    "src/objects/dependent-code.cc",
    "src/objects/elements-kind.cc",
    "src/objects/elements.cc",
    "src/objects/embedder-data-array.cc",
    "src/objects/feedback-vector.cc",
    "src/objects/field-type.cc",
    "src/objects/fixed-array.cc",
    "src/objects/instruction-stream.cc",
    "src/objects/intl-objects.cc",
    "src/objects/js-array-buffer.cc",
    "src/objects/js-atomics-synchronization.cc",
    "src/objects/js-break-iterator.cc",
    "src/objects/js-collator.cc",
    "src/objects/js-date-time-format.cc",
    "src/objects/js-display-names.cc",
    "src/objects/js-duration-format.cc",
    "src/objects/js-function.cc",
    "src/objects/js-list-format.cc",
    "src/objects/js-locale.cc",
    "src/objects/js-number-format.cc",
    "src/objects/js-objects.cc",
    "src/objects/js-plural-rules.cc",
    "src/objects/js-raw-json.cc",
    "src/objects/js-regexp.cc",
    "src/objects/js-relative-time-format.cc",
    "src/objects/js-segment-iterator.cc",
    "src/objects/js-segmenter.cc",
    "src/objects/js-segments.cc",
    "src/objects/js-struct.cc",
    "src/objects/js-temporal-objects.cc",
    "src/objects/keys.cc",
    "src/objects/literal-objects.cc",
    "src/objects/lookup-cache.cc",
    "src/objects/lookup.cc",
    "src/objects/managed.cc",
    "src/objects/map-updater.cc",
    "src/objects/map.cc",
    "src/objects/module.cc",
    "src/objects/object-type.cc",
    "src/objects/objects.cc",
    "src/objects/option-utils.cc",
    "src/objects/ordered-hash-table.cc",
    "src/objects/property-descriptor.cc",
    "src/objects/property.cc",
    "src/objects/regexp-match-info.cc",
    "src/objects/scope-info.cc",
    "src/objects/shared-function-info.cc",
    "src/objects/simd.cc",
    "src/objects/source-text-module.cc",
    "src/objects/string-comparator.cc",
    "src/objects/string-forwarding-table.cc",
    "src/objects/string-table.cc",
    "src/objects/string.cc",
    "src/objects/swiss-name-dictionary.cc",
    "src/objects/symbol-table.cc",
    "src/objects/synthetic-module.cc",
    "src/objects/tagged-impl.cc",
    "src/objects/template-objects.cc",
    "src/objects/templates.cc",
    "src/objects/transitions.cc",
    "src/objects/type-hints.cc",
    "src/objects/value-serializer.cc",
    "src/objects/visitors.cc",
    "src/parsing/func-name-inferrer.cc",
    "src/parsing/import-assertions.cc",
    "src/parsing/literal-buffer.cc",
    "src/parsing/parse-info.cc",
    "src/parsing/parser.cc",
    "src/parsing/parsing.cc",
    "src/parsing/pending-compilation-error-handler.cc",
    "src/parsing/preparse-data.cc",
    "src/parsing/preparser.cc",
    "src/parsing/rewriter.cc",
    "src/parsing/scanner-character-streams.cc",
    "src/parsing/scanner.cc",
    "src/parsing/token.cc",
    "src/profiler/allocation-tracker.cc",
    "src/profiler/cpu-profiler.cc",
    "src/profiler/heap-profiler.cc",
    "src/profiler/heap-snapshot-generator.cc",
    "src/profiler/profile-generator.cc",
    "src/profiler/profiler-listener.cc",
    "src/profiler/profiler-stats.cc",
    "src/profiler/sampling-heap-profiler.cc",
    "src/profiler/strings-storage.cc",
    "src/profiler/symbolizer.cc",
    "src/profiler/tick-sample.cc",
    "src/profiler/tracing-cpu-profiler.cc",
    "src/profiler/weak-code-registry.cc",
    "src/regexp/experimental/experimental-bytecode.cc",
    "src/regexp/experimental/experimental-compiler.cc",
    "src/regexp/experimental/experimental-interpreter.cc",
    "src/regexp/experimental/experimental.cc",
    "src/regexp/regexp-ast.cc",
    "src/regexp/regexp-bytecode-generator.cc",
    "src/regexp/regexp-bytecode-peephole.cc",
    "src/regexp/regexp-bytecodes.cc",
    "src/regexp/regexp-compiler-tonode.cc",
    "src/regexp/regexp-compiler.cc",
    "src/regexp/regexp-dotprinter.cc",
    "src/regexp/regexp-error.cc",
    "src/regexp/regexp-interpreter.cc",
    "src/regexp/regexp-macro-assembler-tracer.cc",
    "src/regexp/regexp-macro-assembler.cc",
    "src/regexp/regexp-parser.cc",
    "src/regexp/regexp-stack.cc",
    "src/regexp/regexp-utils.cc",
    "src/regexp/regexp.cc",
    "src/roots/roots.cc",
    "src/runtime/runtime-array.cc",
    "src/runtime/runtime-atomics.cc",
    "src/runtime/runtime-bigint.cc",
    "src/runtime/runtime-classes.cc",
    "src/runtime/runtime-collections.cc",
    "src/runtime/runtime-compiler.cc",
    "src/runtime/runtime-date.cc",
    "src/runtime/runtime-debug.cc",
    "src/runtime/runtime-forin.cc",
    "src/runtime/runtime-function.cc",
    "src/runtime/runtime-futex.cc",
    "src/runtime/runtime-generator.cc",
    "src/runtime/runtime-internal.cc",
    "src/runtime/runtime-intl.cc",
    "src/runtime/runtime-literals.cc",
    "src/runtime/runtime-module.cc",
    "src/runtime/runtime-numbers.cc",
    "src/runtime/runtime-object.cc",
    "src/runtime/runtime-operators.cc",
    "src/runtime/runtime-promise.cc",
    "src/runtime/runtime-proxy.cc",
    "src/runtime/runtime-regexp.cc",
    "src/runtime/runtime-scopes.cc",
    "src/runtime/runtime-shadow-realm.cc",
    "src/runtime/runtime-strings.cc",
    "src/runtime/runtime-symbol.cc",
    "src/runtime/runtime-temporal.cc",
    "src/runtime/runtime-test.cc",
    "src/runtime/runtime-trace.cc",
    "src/runtime/runtime-typedarray.cc",
    "src/runtime/runtime-weak-refs.cc",
    "src/runtime/runtime.cc",
    "src/sandbox/code-pointer-table.cc",
    "src/sandbox/external-pointer-table.cc",
    "src/sandbox/sandbox.cc",
    "src/sandbox/testing.cc",
    "src/sandbox/trusted-pointer-table.cc",
    "src/snapshot/code-serializer.cc",
    "src/snapshot/context-deserializer.cc",
    "src/snapshot/context-serializer.cc",
    "src/snapshot/deserializer.cc",
    "src/snapshot/embedded/embedded-data.cc",
    "src/snapshot/object-deserializer.cc",
    "src/snapshot/read-only-deserializer.cc",
    "src/snapshot/read-only-serializer.cc",
    "src/snapshot/roots-serializer.cc",
    "src/snapshot/serializer-deserializer.cc",
    "src/snapshot/serializer.cc",
    "src/snapshot/shared-heap-deserializer.cc",
    "src/snapshot/shared-heap-serializer.cc",
    "src/snapshot/snapshot-data.cc",
    "src/snapshot/snapshot-source-sink.cc",
    "src/snapshot/snapshot-utils.cc",
    "src/snapshot/snapshot.cc",
    "src/snapshot/sort-builtins.cc",
    "src/snapshot/startup-deserializer.cc",
    "src/snapshot/startup-serializer.cc",
    "src/strings/char-predicates.cc",
    "src/strings/string-builder.cc",
    "src/strings/string-case.cc",
    "src/strings/string-stream.cc",
    "src/strings/unicode-decoder.cc",
    "src/strings/unicode.cc",
    "src/strings/uri.cc",
    "src/tasks/cancelable-task.cc",
    "src/tasks/operations-barrier.cc",
    "src/tasks/task-utils.cc",
    "src/temporal/temporal-parser.cc",
    "src/third_party/siphash/halfsiphash.cc",
    "src/tracing/trace-event.cc",
    "src/tracing/traced-value.cc",
    "src/tracing/tracing-category-observer.cc",
    "src/utils/address-map.cc",
    "src/utils/allocation.cc",
    "src/utils/bit-vector.cc",
    "src/utils/detachable-vector.cc",
    "src/utils/hex-format.cc",
    "src/utils/identity-map.cc",
    "src/utils/memcopy.cc",
    "src/utils/ostreams.cc",
    "src/utils/sha-256.cc",
    "src/utils/utils.cc",
    "src/utils/version.cc",
    "src/zone/accounting-allocator.cc",
    "src/zone/type-stats.cc",
    "src/zone/zone-segment.cc",
    "src/zone/zone.cc",
  ]

  if (v8_enable_snapshot_compression) {
    sources += [ "src/snapshot/snapshot-compression.cc" ]
  }

  if (v8_enable_sparkplug) {
    sources += [
      "src/baseline/baseline-batch-compiler.cc",
      "src/baseline/baseline-compiler.cc",
    ]
  }

  if (v8_enable_maglev) {
    sources += [
      "src/maglev/maglev-assembler.cc",
      "src/maglev/maglev-code-generator.cc",
      "src/maglev/maglev-compilation-info.cc",
      "src/maglev/maglev-compilation-unit.cc",
      "src/maglev/maglev-compiler.cc",
      "src/maglev/maglev-concurrent-dispatcher.cc",
      "src/maglev/maglev-graph-builder.cc",
      "src/maglev/maglev-graph-printer.cc",
      "src/maglev/maglev-interpreter-frame-state.cc",
      "src/maglev/maglev-ir.cc",
      "src/maglev/maglev-phi-representation-selector.cc",
      "src/maglev/maglev-pipeline-statistics.cc",
      "src/maglev/maglev-regalloc.cc",
      "src/maglev/maglev.cc",
    ]
    if (v8_current_cpu == "arm") {
      sources += [
        "src/maglev/arm/maglev-assembler-arm.cc",
        "src/maglev/arm/maglev-ir-arm.cc",
      ]
    } else if (v8_current_cpu == "arm64") {
      sources += [
        "src/maglev/arm64/maglev-assembler-arm64.cc",
        "src/maglev/arm64/maglev-ir-arm64.cc",
      ]
    } else if (v8_current_cpu == "x64") {
      sources += [
        "src/maglev/x64/maglev-assembler-x64.cc",
        "src/maglev/x64/maglev-ir-x64.cc",
      ]
    }
  }

  if (v8_use_perfetto) {
    sources += [
      "src/tracing/code-data-source.cc",
      "src/tracing/perfetto-logger.cc",
      "src/tracing/perfetto-utils.cc",
    ]
  }

  if (v8_enable_webassembly) {
    sources += [
      ### gcmole(all) ###
      "src/asmjs/asm-js.cc",
      "src/asmjs/asm-parser.cc",
      "src/asmjs/asm-scanner.cc",
      "src/asmjs/asm-types.cc",
      "src/compiler/turboshaft/wasm-dead-code-elimination-phase.cc",
      "src/debug/debug-wasm-objects.cc",
      "src/runtime/runtime-test-wasm.cc",
      "src/runtime/runtime-wasm.cc",
      "src/trap-handler/handler-inside.cc",
      "src/trap-handler/handler-outside.cc",
      "src/trap-handler/handler-shared.cc",
      "src/wasm/baseline/liftoff-assembler.cc",
      "src/wasm/baseline/liftoff-compiler.cc",
      "src/wasm/baseline/parallel-move.cc",
      "src/wasm/canonical-types.cc",
      "src/wasm/code-space-access.cc",
      "src/wasm/constant-expression-interface.cc",
      "src/wasm/constant-expression.cc",
      "src/wasm/function-body-decoder.cc",
      "src/wasm/function-compiler.cc",
      "src/wasm/fuzzing/random-module-generation.cc",
      "src/wasm/graph-builder-interface.cc",
      "src/wasm/jump-table-assembler.cc",
      "src/wasm/local-decl-encoder.cc",
      "src/wasm/memory-tracing.cc",
      "src/wasm/module-compiler.cc",
      "src/wasm/module-decoder.cc",
      "src/wasm/module-instantiate.cc",
      "src/wasm/names-provider.cc",
      "src/wasm/pgo.cc",
      "src/wasm/simd-shuffle.cc",
      "src/wasm/stacks.cc",
      "src/wasm/streaming-decoder.cc",
      "src/wasm/sync-streaming-decoder.cc",
      "src/wasm/turboshaft-graph-interface.cc",
      "src/wasm/value-type.cc",
      "src/wasm/wasm-code-manager.cc",
      "src/wasm/wasm-debug.cc",
      "src/wasm/wasm-disassembler.cc",
      "src/wasm/wasm-engine.cc",
      "src/wasm/wasm-external-refs.cc",
      "src/wasm/wasm-features.cc",
      "src/wasm/wasm-import-wrapper-cache.cc",
      "src/wasm/wasm-js.cc",
      "src/wasm/wasm-module-builder.cc",
      "src/wasm/wasm-module-sourcemap.cc",
      "src/wasm/wasm-module.cc",
      "src/wasm/wasm-objects.cc",
      "src/wasm/wasm-opcodes.cc",
      "src/wasm/wasm-result.cc",
      "src/wasm/wasm-serialization.cc",
      "src/wasm/wasm-subtyping.cc",
      "src/wasm/well-known-imports.cc",
      "src/wasm/wrappers.cc",
    ]
  }

  if (v8_enable_third_party_heap) {
    sources += filter_exclude(v8_third_party_heap_files, [ "*.h" ])
  } else {
    sources += [ "src/heap/third-party/heap-api-stub.cc" ]
  }

  if (v8_enable_conservative_stack_scanning) {
    sources += [ "src/heap/conservative-stack-visitor.cc" ]
  }

  if (v8_enable_wasm_gdb_remote_debugging) {
    sources += [
      "src/debug/wasm/gdb-server/gdb-remote-util.cc",
      "src/debug/wasm/gdb-server/gdb-server-thread.cc",
      "src/debug/wasm/gdb-server/gdb-server.cc",
      "src/debug/wasm/gdb-server/packet.cc",
      "src/debug/wasm/gdb-server/session.cc",
      "src/debug/wasm/gdb-server/target.cc",
      "src/debug/wasm/gdb-server/transport.cc",
      "src/debug/wasm/gdb-server/wasm-module-debug.cc",
    ]
  }

  if (v8_enable_heap_snapshot_verify) {
    sources += [ "src/heap/reference-summarizer.cc" ]
  }

  if (v8_current_cpu == "x86") {
    sources += [
      ### gcmole(ia32) ###
      "src/codegen/ia32/assembler-ia32.cc",
      "src/codegen/ia32/cpu-ia32.cc",
      "src/codegen/ia32/macro-assembler-ia32.cc",
      "src/codegen/shared-ia32-x64/macro-assembler-shared-ia32-x64.cc",
      "src/deoptimizer/ia32/deoptimizer-ia32.cc",
      "src/diagnostics/ia32/disasm-ia32.cc",
      "src/diagnostics/ia32/unwinder-ia32.cc",
      "src/execution/ia32/frame-constants-ia32.cc",
      "src/regexp/ia32/regexp-macro-assembler-ia32.cc",
    ]
  } else if (v8_current_cpu == "x64") {
    sources += [
      ### gcmole(x64) ###
      "src/codegen/shared-ia32-x64/macro-assembler-shared-ia32-x64.cc",
      "src/codegen/x64/assembler-x64.cc",
      "src/codegen/x64/cpu-x64.cc",
      "src/codegen/x64/macro-assembler-x64.cc",
      "src/deoptimizer/x64/deoptimizer-x64.cc",
      "src/diagnostics/x64/disasm-x64.cc",
      "src/diagnostics/x64/eh-frame-x64.cc",
      "src/diagnostics/x64/unwinder-x64.cc",
      "src/execution/x64/frame-constants-x64.cc",
      "src/regexp/x64/regexp-macro-assembler-x64.cc",
    ]

    if (is_win) {
      sources += [ "src/diagnostics/unwinding-info-win64.cc" ]
    }

    if (v8_enable_webassembly) {
      # iOS Xcode simulator builds run on an x64 target. iOS and macOS are both
      # based on Darwin and thus POSIX-compliant to a similar degree.
      if (is_linux || is_chromeos || is_mac || is_ios ||
          target_os == "freebsd") {
        sources += [
          "src/trap-handler/handler-inside-posix.cc",
          "src/trap-handler/handler-outside-posix.cc",
        ]
      } else if (is_win) {
        sources += [
          "src/trap-handler/handler-inside-win.cc",
          "src/trap-handler/handler-outside-win.cc",
        ]
      }
    }
  } else if (v8_current_cpu == "arm") {
    sources += [
      ### gcmole(arm) ###
      "src/codegen/arm/assembler-arm.cc",
      "src/codegen/arm/constants-arm.cc",
      "src/codegen/arm/cpu-arm.cc",
      "src/codegen/arm/macro-assembler-arm.cc",
      "src/deoptimizer/arm/deoptimizer-arm.cc",
      "src/diagnostics/arm/disasm-arm.cc",
      "src/diagnostics/arm/eh-frame-arm.cc",
      "src/diagnostics/arm/unwinder-arm.cc",
      "src/execution/arm/frame-constants-arm.cc",
      "src/execution/arm/simulator-arm.cc",
      "src/regexp/arm/regexp-macro-assembler-arm.cc",
    ]
  } else if (v8_current_cpu == "arm64") {
    sources += [
      ### gcmole(arm64) ###
      "src/codegen/arm64/assembler-arm64.cc",
      "src/codegen/arm64/cpu-arm64.cc",
      "src/codegen/arm64/decoder-arm64.cc",
      "src/codegen/arm64/instructions-arm64-constants.cc",
      "src/codegen/arm64/instructions-arm64.cc",
      "src/codegen/arm64/macro-assembler-arm64.cc",
      "src/codegen/arm64/register-arm64.cc",
      "src/codegen/arm64/utils-arm64.cc",
      "src/deoptimizer/arm64/deoptimizer-arm64.cc",
      "src/diagnostics/arm64/disasm-arm64.cc",
      "src/diagnostics/arm64/eh-frame-arm64.cc",
      "src/diagnostics/arm64/unwinder-arm64.cc",
      "src/execution/arm64/frame-constants-arm64.cc",
      "src/execution/arm64/pointer-auth-arm64.cc",
      "src/execution/arm64/simulator-arm64.cc",
      "src/execution/arm64/simulator-logic-arm64.cc",
      "src/regexp/arm64/regexp-macro-assembler-arm64.cc",
    ]
    if (v8_enable_webassembly) {
      # Trap handling is enabled on arm64 Mac and Linux and in simulators on
      # x64 on Linux, Mac, and Windows.
      if ((current_cpu == "arm64" && (is_linux || is_chromeos || is_apple)) ||
          (current_cpu == "x64" && (is_linux || is_chromeos || is_mac))) {
        sources += [
          "src/trap-handler/handler-inside-posix.cc",
          "src/trap-handler/handler-outside-posix.cc",
        ]
      } else if (current_cpu == "x64" && is_win) {
        sources += [
          "src/trap-handler/handler-inside-win.cc",
          "src/trap-handler/handler-outside-win.cc",
        ]
      }
      if (current_cpu == "x64" &&
          (is_linux || is_chromeos || is_mac || is_win)) {
        sources += [ "src/trap-handler/handler-outside-simulator.cc" ]
      }
    }
    if (is_win) {
      sources += [ "src/diagnostics/unwinding-info-win64.cc" ]
    }
  } else if (v8_current_cpu == "mips64" || v8_current_cpu == "mips64el") {
    sources += [
      ### gcmole(mips64el) ###
      "src/codegen/mips64/assembler-mips64.cc",
      "src/codegen/mips64/constants-mips64.cc",
      "src/codegen/mips64/cpu-mips64.cc",
      "src/codegen/mips64/interface-descriptors-mips64-inl.h",
      "src/codegen/mips64/macro-assembler-mips64.cc",
      "src/deoptimizer/mips64/deoptimizer-mips64.cc",
      "src/diagnostics/mips64/disasm-mips64.cc",
      "src/diagnostics/mips64/unwinder-mips64.cc",
      "src/execution/mips64/frame-constants-mips64.cc",
      "src/execution/mips64/simulator-mips64.cc",
      "src/regexp/mips64/regexp-macro-assembler-mips64.cc",
    ]
  } else if (v8_current_cpu == "loong64") {
    sources += [
      ### gcmole(loong64) ###
      "src/codegen/loong64/assembler-loong64.cc",
      "src/codegen/loong64/constants-loong64.cc",
      "src/codegen/loong64/cpu-loong64.cc",
      "src/codegen/loong64/interface-descriptors-loong64-inl.h",
      "src/codegen/loong64/macro-assembler-loong64.cc",
      "src/deoptimizer/loong64/deoptimizer-loong64.cc",
      "src/diagnostics/loong64/disasm-loong64.cc",
      "src/diagnostics/loong64/unwinder-loong64.cc",
      "src/execution/loong64/frame-constants-loong64.cc",
      "src/execution/loong64/simulator-loong64.cc",
      "src/regexp/loong64/regexp-macro-assembler-loong64.cc",
    ]
    if (v8_enable_webassembly) {
      # Trap handling is enabled on loong64 Linux and in simulators on
      # x64 on Linux.
      if ((current_cpu == "loong64" && is_linux) ||
          (current_cpu == "x64" && is_linux)) {
        sources += [
          "src/trap-handler/handler-inside-posix.cc",
          "src/trap-handler/handler-outside-posix.cc",
        ]
      }
      if (current_cpu == "x64" && is_linux) {
        sources += [ "src/trap-handler/handler-outside-simulator.cc" ]
      }
    }
  } else if (v8_current_cpu == "ppc") {
    sources += [
      ### gcmole(ppc) ###
      "src/codegen/ppc/assembler-ppc.cc",
      "src/codegen/ppc/constants-ppc.cc",
      "src/codegen/ppc/cpu-ppc.cc",
      "src/codegen/ppc/macro-assembler-ppc.cc",
      "src/deoptimizer/ppc/deoptimizer-ppc.cc",
      "src/diagnostics/ppc/disasm-ppc.cc",
      "src/diagnostics/ppc/eh-frame-ppc.cc",
      "src/diagnostics/ppc/unwinder-ppc.cc",
      "src/execution/ppc/frame-constants-ppc.cc",
      "src/execution/ppc/simulator-ppc.cc",
      "src/regexp/ppc/regexp-macro-assembler-ppc.cc",
    ]
  } else if (v8_current_cpu == "ppc64") {
    sources += [
      ### gcmole(ppc64) ###
      "src/codegen/ppc/assembler-ppc.cc",
      "src/codegen/ppc/constants-ppc.cc",
      "src/codegen/ppc/cpu-ppc.cc",
      "src/codegen/ppc/macro-assembler-ppc.cc",
      "src/deoptimizer/ppc/deoptimizer-ppc.cc",
      "src/diagnostics/ppc/disasm-ppc.cc",
      "src/diagnostics/ppc/eh-frame-ppc.cc",
      "src/diagnostics/ppc/unwinder-ppc.cc",
      "src/execution/ppc/frame-constants-ppc.cc",
      "src/execution/ppc/simulator-ppc.cc",
      "src/regexp/ppc/regexp-macro-assembler-ppc.cc",
    ]
  } else if (v8_current_cpu == "s390" || v8_current_cpu == "s390x") {
    sources += [
      ### gcmole(s390) ###
      "src/codegen/s390/assembler-s390.cc",
      "src/codegen/s390/constants-s390.cc",
      "src/codegen/s390/cpu-s390.cc",
      "src/codegen/s390/macro-assembler-s390.cc",
      "src/deoptimizer/s390/deoptimizer-s390.cc",
      "src/diagnostics/s390/disasm-s390.cc",
      "src/diagnostics/s390/eh-frame-s390.cc",
      "src/diagnostics/s390/unwinder-s390.cc",
      "src/execution/s390/frame-constants-s390.cc",
      "src/execution/s390/simulator-s390.cc",
      "src/regexp/s390/regexp-macro-assembler-s390.cc",
    ]
  } else if (v8_current_cpu == "riscv64") {
    sources += [
      ### gcmole(riscv64) ###
      "src/codegen/riscv/assembler-riscv.cc",
      "src/codegen/riscv/base-assembler-riscv.cc",
      "src/codegen/riscv/base-constants-riscv.cc",
      "src/codegen/riscv/base-riscv-i.cc",
      "src/codegen/riscv/cpu-riscv.cc",
      "src/codegen/riscv/extension-riscv-a.cc",
      "src/codegen/riscv/extension-riscv-b.cc",
      "src/codegen/riscv/extension-riscv-c.cc",
      "src/codegen/riscv/extension-riscv-d.cc",
      "src/codegen/riscv/extension-riscv-f.cc",
      "src/codegen/riscv/extension-riscv-m.cc",
      "src/codegen/riscv/extension-riscv-v.cc",
      "src/codegen/riscv/extension-riscv-zicsr.cc",
      "src/codegen/riscv/extension-riscv-zifencei.cc",
      "src/codegen/riscv/macro-assembler-riscv.cc",
      "src/deoptimizer/riscv/deoptimizer-riscv.cc",
      "src/diagnostics/riscv/disasm-riscv.cc",
      "src/diagnostics/riscv/unwinder-riscv.cc",
      "src/execution/riscv/frame-constants-riscv.cc",
      "src/execution/riscv/simulator-riscv.cc",
      "src/regexp/riscv/regexp-macro-assembler-riscv.cc",
    ]
    if (v8_enable_webassembly) {
      # Trap handling is enabled on riscv64 Linux and in simulators on
      # x64 on Linux.
      if ((current_cpu == "riscv64" && is_linux) ||
          (current_cpu == "x64" && is_linux)) {
        sources += [
          "src/trap-handler/handler-inside-posix.cc",
          "src/trap-handler/handler-outside-posix.cc",
        ]
      }
      if (current_cpu == "x64" && is_linux) {
        sources += [ "src/trap-handler/handler-outside-simulator.cc" ]
      }
    }
  } else if (v8_current_cpu == "riscv32") {
    sources += [
      ### gcmole(riscv32) ###
      "src/codegen/riscv/assembler-riscv.cc",
      "src/codegen/riscv/base-assembler-riscv.cc",
      "src/codegen/riscv/base-constants-riscv.cc",
      "src/codegen/riscv/base-riscv-i.cc",
      "src/codegen/riscv/cpu-riscv.cc",
      "src/codegen/riscv/extension-riscv-a.cc",
      "src/codegen/riscv/extension-riscv-b.cc",
      "src/codegen/riscv/extension-riscv-c.cc",
      "src/codegen/riscv/extension-riscv-d.cc",
      "src/codegen/riscv/extension-riscv-f.cc",
      "src/codegen/riscv/extension-riscv-m.cc",
      "src/codegen/riscv/extension-riscv-v.cc",
      "src/codegen/riscv/extension-riscv-zicsr.cc",
      "src/codegen/riscv/extension-riscv-zifencei.cc",
      "src/codegen/riscv/macro-assembler-riscv.cc",
      "src/deoptimizer/riscv/deoptimizer-riscv.cc",
      "src/diagnostics/riscv/disasm-riscv.cc",
      "src/diagnostics/riscv/unwinder-riscv.cc",
      "src/execution/riscv/frame-constants-riscv.cc",
      "src/execution/riscv/simulator-riscv.cc",
      "src/regexp/riscv/regexp-macro-assembler-riscv.cc",
    ]
  }

  # Architecture independent but platform-specific sources
  if (is_win) {
    if (v8_enable_etw_stack_walking) {
      sources += [
        "src/diagnostics/etw-jit-win.cc",
        "src/diagnostics/etw-jit-win.h",
      ]
    }
  }

  configs = [
    ":internal_config",
    ":cppgc_base_config",
  ]

  deps = [
    ":torque_generated_definitions",
    ":v8_bigint",
    ":v8_headers",
    ":v8_heap_base",
    ":v8_libbase",
    ":v8_shared_internal_headers",
    ":v8_tracing",
    ":v8_version",
    "src/inspector:inspector",
  ]

  public_deps = [
    ":cppgc_base",
    ":generate_bytecode_builtins_list",
    ":run_torque",
    ":v8_abseil",
    ":v8_headers",
    ":v8_internal_headers",
    ":v8_maybe_icu",
  ]

  if (v8_fuzzilli) {
    sources += [
      "src/fuzzilli/cov.cc",
      "src/fuzzilli/cov.h",
      "src/fuzzilli/fuzzilli.cc",
      "src/fuzzilli/fuzzilli.h",
    ]
  }

  if (v8_enable_i18n_support) {
    deps += [ ":run_gen-regexp-special-case" ]
    sources += [ "$target_gen_dir/src/regexp/special-case.cc" ]
    if (is_win) {
      deps += [ "$v8_icu_path:icudata" ]
    }
  } else {
    sources -= [
      "src/builtins/builtins-intl.cc",
      "src/objects/intl-objects.cc",
      "src/objects/js-break-iterator.cc",
      "src/objects/js-collator.cc",
      "src/objects/js-date-time-format.cc",
      "src/objects/js-display-names.cc",
      "src/objects/js-duration-format.cc",
      "src/objects/js-list-format.cc",
      "src/objects/js-locale.cc",
      "src/objects/js-number-format.cc",
      "src/objects/js-plural-rules.cc",
      "src/objects/js-relative-time-format.cc",
      "src/objects/js-segment-iterator.cc",
      "src/objects/js-segmenter.cc",
      "src/objects/js-segments.cc",
      "src/runtime/runtime-intl.cc",
      "src/strings/char-predicates.cc",
    ]
  }

  if (v8_use_zlib) {
    deps += [
      "$v8_zlib_path",
      "$v8_zlib_path/google:compression_utils_portable",
    ]
  }

  if (v8_postmortem_support) {
    sources += [ "$target_gen_dir/debug-support.cc" ]
    deps += [ ":postmortem-metadata" ]
  }

  libs = []

  if (v8_enable_third_party_heap) {
    libs += v8_third_party_heap_libs
  }

  # Platforms that don't have CAS support need to link atomic library
  # to implement atomic memory access
  if (v8_current_cpu == "mips64" || v8_current_cpu == "mips64el" ||
      v8_current_cpu == "ppc" || v8_current_cpu == "ppc64" ||
      v8_current_cpu == "s390" || v8_current_cpu == "s390x" ||
      v8_current_cpu == "riscv64" || v8_current_cpu == "riscv32") {
    if (!is_clang) {
      libs += [ "atomic" ]
    }
  }

  if (v8_enable_vtunetracemark && (is_linux || is_chromeos || is_win)) {
    sources += [
      "src/extensions/vtunedomain-support-extension.cc",
      "src/extensions/vtunedomain-support-extension.h",
    ]
    deps += [ "src/third_party/vtune:v8_vtune_trace_mark" ]
  }
}

group("v8_base") {
  public_deps = [
    ":v8_base_without_compiler",
    ":v8_compiler",
  ]

  if (v8_enable_turbofan) {
    public_deps += [ ":v8_turboshaft" ]
  }
}

v8_source_set("torque_base") {
  visibility = [ ":*" ]  # Only targets in this file can depend on this.

  sources = [
    "src/numbers/integer-literal-inl.h",
    "src/numbers/integer-literal.h",
    "src/torque/ast.h",
    "src/torque/cc-generator.cc",
    "src/torque/cc-generator.h",
    "src/torque/cfg.cc",
    "src/torque/cfg.h",
    "src/torque/class-debug-reader-generator.cc",
    "src/torque/constants.h",
    "src/torque/cpp-builder.cc",
    "src/torque/cpp-builder.h",
    "src/torque/csa-generator.cc",
    "src/torque/csa-generator.h",
    "src/torque/declarable.cc",
    "src/torque/declarable.h",
    "src/torque/declaration-visitor.cc",
    "src/torque/declaration-visitor.h",
    "src/torque/declarations.cc",
    "src/torque/declarations.h",
    "src/torque/earley-parser.cc",
    "src/torque/earley-parser.h",
    "src/torque/global-context.cc",
    "src/torque/global-context.h",
    "src/torque/implementation-visitor.cc",
    "src/torque/implementation-visitor.h",
    "src/torque/instance-type-generator.cc",
    "src/torque/instructions.cc",
    "src/torque/instructions.h",
    "src/torque/kythe-data.cc",
    "src/torque/kythe-data.h",
    "src/torque/parameter-difference.h",
    "src/torque/server-data.cc",
    "src/torque/server-data.h",
    "src/torque/source-positions.cc",
    "src/torque/source-positions.h",
    "src/torque/torque-code-generator.cc",
    "src/torque/torque-code-generator.h",
    "src/torque/torque-compiler.cc",
    "src/torque/torque-compiler.h",
    "src/torque/torque-parser.cc",
    "src/torque/torque-parser.h",
    "src/torque/type-inference.cc",
    "src/torque/type-inference.h",
    "src/torque/type-oracle.cc",
    "src/torque/type-oracle.h",
    "src/torque/type-visitor.cc",
    "src/torque/type-visitor.h",
    "src/torque/types.cc",
    "src/torque/types.h",
    "src/torque/utils.cc",
    "src/torque/utils.h",
  ]

  deps = [
    ":v8_flags",
    ":v8_shared_internal_headers",
  ]

  public_deps = [ ":v8_libbase" ]

  # The use of exceptions for Torque in violation of the Chromium style-guide
  # is justified by the fact that it is only used from the non-essential
  # language server and can be removed anytime if it causes problems.
  configs = [
    ":internal_config",
    "//build/config/compiler:exceptions",
    "//build/config/compiler:rtti",
  ]

  remove_configs = [
    "//build/config/compiler:no_exceptions",
    "//build/config/compiler:no_rtti",
  ]

  if (is_debug && !v8_optimized_debug && v8_enable_fast_torque) {
    # The :no_optimize config is added to v8_add_configs in v8.gni.
    remove_configs += [ "//build/config/compiler:no_optimize" ]
    configs += [ ":always_turbofanimize" ]
  }
}

v8_source_set("torque_ls_base") {
  sources = [
    "src/torque/ls/globals.h",
    "src/torque/ls/json-parser.cc",
    "src/torque/ls/json-parser.h",
    "src/torque/ls/json.cc",
    "src/torque/ls/json.h",
    "src/torque/ls/message-handler.cc",
    "src/torque/ls/message-handler.h",
    "src/torque/ls/message-macros.h",
    "src/torque/ls/message-pipe.h",
    "src/torque/ls/message.h",
  ]

  public_deps = [ ":torque_base" ]

  # The use of exceptions for Torque in violation of the Chromium style-guide
  # is justified by the fact that it is only used from the non-essential
  # language server and can be removed anytime if it causes problems.
  configs = [
    ":internal_config",
    "//build/config/compiler:exceptions",
    "//build/config/compiler:rtti",
  ]

  remove_configs = [
    "//build/config/compiler:no_exceptions",
    "//build/config/compiler:no_rtti",
  ]
}

v8_component("v8_libbase") {
  sources = [
    "src/base/abort-mode.cc",
    "src/base/abort-mode.h",
    "src/base/address-region.h",
    "src/base/atomic-utils.h",
    "src/base/atomicops.h",
    "src/base/base-export.h",
    "src/base/bit-field.h",
    "src/base/bits-iterator.h",
    "src/base/bits.cc",
    "src/base/bits.h",
    "src/base/bounded-page-allocator.cc",
    "src/base/bounded-page-allocator.h",
    "src/base/bounds.h",
    "src/base/build_config.h",
    "src/base/compiler-specific.h",
    "src/base/container-utils.h",
    "src/base/contextual.h",
    "src/base/cpu.cc",
    "src/base/cpu.h",
    "src/base/debug/stack_trace.cc",
    "src/base/debug/stack_trace.h",
    "src/base/discriminated-union.h",
    "src/base/division-by-constant.cc",
    "src/base/division-by-constant.h",
    "src/base/doubly-threaded-list.h",
    "src/base/emulated-virtual-address-subspace.cc",
    "src/base/emulated-virtual-address-subspace.h",
    "src/base/enum-set.h",
    "src/base/export-template.h",
    "src/base/file-utils.cc",
    "src/base/file-utils.h",
    "src/base/flags.h",
    "src/base/free_deleter.h",
    "src/base/functional.h",
    "src/base/hashmap-entry.h",
    "src/base/hashmap.h",
    "src/base/ieee754.cc",
    "src/base/ieee754.h",
    "src/base/immediate-crash.h",
    "src/base/intrusive-set.h",
    "src/base/iterator.h",
    "src/base/lazy-instance.h",
    "src/base/logging.cc",
    "src/base/logging.h",
    "src/base/macros.h",
    "src/base/memory.h",
    "src/base/numbers/bignum-dtoa.cc",
    "src/base/numbers/bignum-dtoa.h",
    "src/base/numbers/bignum.cc",
    "src/base/numbers/bignum.h",
    "src/base/numbers/cached-powers.cc",
    "src/base/numbers/cached-powers.h",
    "src/base/numbers/diy-fp.cc",
    "src/base/numbers/diy-fp.h",
    "src/base/numbers/double.h",
    "src/base/numbers/dtoa.cc",
    "src/base/numbers/dtoa.h",
    "src/base/numbers/fast-dtoa.cc",
    "src/base/numbers/fast-dtoa.h",
    "src/base/numbers/fixed-dtoa.cc",
    "src/base/numbers/fixed-dtoa.h",
    "src/base/numbers/strtod.cc",
    "src/base/numbers/strtod.h",
    "src/base/once.cc",
    "src/base/once.h",
    "src/base/optional.h",
    "src/base/overflowing-math.h",
    "src/base/page-allocator.cc",
    "src/base/page-allocator.h",
    "src/base/platform/condition-variable.cc",
    "src/base/platform/condition-variable.h",
    "src/base/platform/elapsed-timer.h",
    "src/base/platform/memory-protection-key.cc",
    "src/base/platform/memory-protection-key.h",
    "src/base/platform/memory.h",
    "src/base/platform/mutex.cc",
    "src/base/platform/mutex.h",
    "src/base/platform/platform.cc",
    "src/base/platform/platform.h",
    "src/base/platform/semaphore.cc",
    "src/base/platform/semaphore.h",
    "src/base/platform/time.cc",
    "src/base/platform/time.h",
    "src/base/platform/wrappers.h",
    "src/base/platform/yield-processor.h",
    "src/base/pointer-with-payload.h",
    "src/base/region-allocator.cc",
    "src/base/region-allocator.h",
    "src/base/ring-buffer.h",
    "src/base/safe_conversions.h",
    "src/base/safe_conversions_arm_impl.h",
    "src/base/safe_conversions_impl.h",
    "src/base/sanitizer/asan.h",
    "src/base/sanitizer/lsan-page-allocator.cc",
    "src/base/sanitizer/lsan-page-allocator.h",
    "src/base/sanitizer/lsan-virtual-address-space.cc",
    "src/base/sanitizer/lsan-virtual-address-space.h",
    "src/base/sanitizer/lsan.h",
    "src/base/sanitizer/msan.h",
    "src/base/sanitizer/tsan.h",
    "src/base/small-map.h",
    "src/base/small-vector.h",
    "src/base/string-format.h",
    "src/base/strings.cc",
    "src/base/strings.h",
    "src/base/sys-info.cc",
    "src/base/sys-info.h",
    "src/base/template-utils.h",
    "src/base/threaded-list.h",
    "src/base/timezone-cache.h",
    "src/base/utils/random-number-generator.cc",
    "src/base/utils/random-number-generator.h",
    "src/base/v8-fallthrough.h",
    "src/base/vector.h",
    "src/base/virtual-address-space-page-allocator.cc",
    "src/base/virtual-address-space-page-allocator.h",
    "src/base/virtual-address-space.cc",
    "src/base/virtual-address-space.h",
    "src/base/vlq-base64.cc",
    "src/base/vlq-base64.h",
    "src/base/vlq.h",
  ]

  configs = [ ":internal_config_base" ]

  public_configs = [ ":libbase_config" ]

  deps = [ ":v8_config_headers" ]

  libs = []

  data = []

  data_deps = []

  defines = []

  if (is_component_build) {
    defines = [ "BUILDING_V8_BASE_SHARED" ]
  }

  if (is_posix || is_fuchsia) {
    sources += [
      "src/base/platform/platform-posix.cc",
      "src/base/platform/platform-posix.h",
    ]
    if (current_os != "aix") {
      sources += [
        "src/base/platform/platform-posix-time.cc",
        "src/base/platform/platform-posix-time.h",
      ]
    }
  }

  if (is_linux || is_chromeos) {
    sources += [
      "src/base/debug/stack_trace_posix.cc",
      "src/base/platform/platform-linux.cc",
      "src/base/platform/platform-linux.h",
    ]

    libs = [
      "dl",
      "rt",
    ]
  } else if (current_os == "aix") {
    sources += [
      "src/base/debug/stack_trace_posix.cc",
      "src/base/platform/platform-aix.cc",
    ]

    libs = [ "dl" ]
  } else if (is_android) {
    if (current_toolchain == host_toolchain) {
      libs = [
        "dl",
        "rt",
      ]
      if (host_os == "mac") {
        sources += [
          "src/base/debug/stack_trace_posix.cc",
          "src/base/platform/platform-darwin.cc",
        ]
      } else {
        sources += [
          "src/base/debug/stack_trace_posix.cc",
          "src/base/platform/platform-linux.cc",
        ]
      }
    } else {
      sources += [
        "src/base/debug/stack_trace_android.cc",
        "src/base/platform/platform-linux.cc",
      ]
    }
  } else if (is_fuchsia) {
    sources += [
      "src/base/debug/stack_trace_fuchsia.cc",
      "src/base/platform/platform-fuchsia.cc",
    ]
    deps += [
      "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.kernel:fuchsia.kernel_cpp",
      "//third_party/fuchsia-sdk/sdk/pkg/component_incoming_cpp",
      "//third_party/fuchsia-sdk/sdk/pkg/zx",
    ]
  } else if (is_mac) {
    sources += [
      "src/base/debug/stack_trace_posix.cc",
      "src/base/platform/platform-darwin.cc",
    ]
  } else if (is_ios) {
    sources += [
      "src/base/debug/stack_trace_posix.cc",
      "src/base/platform/platform-darwin.cc",
      "src/base/platform/platform-ios.cc",
    ]
  } else if (is_win) {
    # TODO(infra): Add support for cygwin.
    sources += [
      "src/base/debug/stack_trace_win.cc",
      "src/base/platform/platform-win32.cc",
      "src/base/platform/platform-win32.h",
      "src/base/win32-headers.h",
    ]

    defines += [ "_CRT_RAND_S" ]  # for rand_s()

    libs = [
      "dbghelp.lib",
      "winmm.lib",
      "ws2_32.lib",
    ]

    if (v8_enable_etw_stack_walking) {
      libs += [ "advapi32.lib" ]  # Needed for TraceLoggingProvider.h
    }

    data_deps += [ "//build/win:runtime_libs" ]
  }

  if (v8_current_cpu == "mips64") {
    # Add runtime libs for mips.
    data += [
      "tools/mips_toolchain/sysroot/usr/lib/",
      "tools/mips_toolchain/mips-mti-linux-gnu/lib",
    ]
  }

  if (is_ubsan && (v8_current_cpu == "x86" || v8_current_cpu == "arm")) {
    # Special UBSan 32-bit requirement.
    sources += [ "src/base/ubsan.cc" ]
  }

  if (v8_current_cpu == "riscv64" || v8_current_cpu == "riscv32") {
    if (!is_clang) {
      libs += [ "atomic" ]
    }
  }

  if (is_tsan && !build_with_chromium) {
    data += [ "tools/sanitizers/tsan_suppressions.txt" ]
  }

  if (using_sanitizer && !build_with_chromium) {
    data_deps +=
        [ "//build/config/clang:llvm-symbolizer_data($host_toolchain)" ]
  }

  if (v8_use_libm_trig_functions) {
    deps += [ ":libm" ]
  }

  # TODO(infra): Add support for qnx, freebsd, openbsd, netbsd, and solaris.
}

if (v8_use_libm_trig_functions) {
  source_set("libm") {
    sources = [
      "third_party/glibc/src/sysdeps/ieee754/dbl-64/branred.c",
      "third_party/glibc/src/sysdeps/ieee754/dbl-64/branred.h",
      "third_party/glibc/src/sysdeps/ieee754/dbl-64/dla.h",
      "third_party/glibc/src/sysdeps/ieee754/dbl-64/endian.h",
      "third_party/glibc/src/sysdeps/ieee754/dbl-64/mydefs.h",
      "third_party/glibc/src/sysdeps/ieee754/dbl-64/s_sin.c",
      "third_party/glibc/src/sysdeps/ieee754/dbl-64/sincostab.c",
      "third_party/glibc/src/sysdeps/ieee754/dbl-64/trig.h",
      "third_party/glibc/src/sysdeps/ieee754/dbl-64/usncs.h",
    ]
    configs += [ "//build/config/compiler:no_chromium_code" ]
    configs -= [ "//build/config/compiler:chromium_code" ]
    if (!is_debug) {
      # Build code using -O3, see: crbug.com/1084371.
      configs += [ "//build/config/compiler:optimize_speed" ]
    }
  }
}

v8_component("v8_libplatform") {
  sources = [
    "//base/trace_event/common/trace_event_common.h",
    "include/libplatform/libplatform-export.h",
    "include/libplatform/libplatform.h",
    "include/libplatform/v8-tracing.h",
    "src/libplatform/default-foreground-task-runner.cc",
    "src/libplatform/default-foreground-task-runner.h",
    "src/libplatform/default-job.cc",
    "src/libplatform/default-job.h",
    "src/libplatform/default-platform.cc",
    "src/libplatform/default-platform.h",
    "src/libplatform/default-thread-isolated-allocator.cc",
    "src/libplatform/default-thread-isolated-allocator.h",
    "src/libplatform/default-worker-threads-task-runner.cc",
    "src/libplatform/default-worker-threads-task-runner.h",
    "src/libplatform/delayed-task-queue.cc",
    "src/libplatform/delayed-task-queue.h",
    "src/libplatform/task-queue.cc",
    "src/libplatform/task-queue.h",
    "src/libplatform/tracing/trace-buffer.cc",
    "src/libplatform/tracing/trace-buffer.h",
    "src/libplatform/tracing/trace-config.cc",
    "src/libplatform/tracing/trace-object.cc",
    "src/libplatform/tracing/trace-writer.cc",
    "src/libplatform/tracing/trace-writer.h",
    "src/libplatform/tracing/tracing-controller.cc",
    "src/libplatform/worker-thread.cc",
    "src/libplatform/worker-thread.h",
  ]

  configs = [ ":internal_config_base" ]

  if (is_component_build) {
    defines = [ "BUILDING_V8_PLATFORM_SHARED" ]
  }

  public_configs = [ ":libplatform_config" ]

  public_deps = []

  deps = [
    ":v8_config_headers",
    ":v8_libbase",
    ":v8_tracing",
  ]

  if (v8_use_perfetto) {
    sources -= [
      "//base/trace_event/common/trace_event_common.h",
      "src/libplatform/tracing/trace-buffer.cc",
      "src/libplatform/tracing/trace-buffer.h",
      "src/libplatform/tracing/trace-object.cc",
      "src/libplatform/tracing/trace-writer.cc",
      "src/libplatform/tracing/trace-writer.h",
    ]
    sources += [ "src/libplatform/tracing/trace-event-listener.h" ]
  }

  if (v8_enable_system_instrumentation) {
    sources += [ "src/libplatform/tracing/recorder.h" ]
    if (is_mac) {
      sources += [ "src/libplatform/tracing/recorder-mac.cc" ]
    } else if (is_win) {
      sources += [ "src/libplatform/tracing/recorder-win.cc" ]
    }
  }

  if (v8_current_cpu == "riscv64" || v8_current_cpu == "riscv32") {
    if (!is_clang) {
      libs = [ "atomic" ]
    }
  }
}

v8_source_set("fuzzer_support") {
  visibility = [ ":*" ]  # Only targets in this file can depend on this.

  sources = [
    "test/fuzzer/fuzzer-support.cc",
    "test/fuzzer/fuzzer-support.h",
  ]

  configs = [ ":internal_config_base" ]

  public_deps = [
    ":v8",
    ":v8_libbase",
    ":v8_libplatform",
    ":v8_maybe_icu",
  ]
}

v8_source_set("v8_bigint") {
  sources = [
    "src/bigint/bigint-internal.cc",
    "src/bigint/bigint-internal.h",
    "src/bigint/bigint.h",
    "src/bigint/bitwise.cc",
    "src/bigint/digit-arithmetic.h",
    "src/bigint/div-burnikel.cc",
    "src/bigint/div-helpers.cc",
    "src/bigint/div-helpers.h",
    "src/bigint/div-schoolbook.cc",
    "src/bigint/fromstring.cc",
    "src/bigint/mul-karatsuba.cc",
    "src/bigint/mul-schoolbook.cc",
    "src/bigint/tostring.cc",
    "src/bigint/util.h",
    "src/bigint/vector-arithmetic.cc",
    "src/bigint/vector-arithmetic.h",
  ]

  if (v8_advanced_bigint_algorithms) {
    sources += [
      "src/bigint/div-barrett.cc",
      "src/bigint/mul-fft.cc",
      "src/bigint/mul-toom.cc",
    ]
  }

  configs = [ ":internal_config" ]
}

v8_header_set("v8_heap_base_headers") {
  sources = [
    "src/heap/base/active-system-pages.h",
    "src/heap/base/basic-slot-set.h",
    "src/heap/base/bytes.h",
    "src/heap/base/incremental-marking-schedule.h",
    "src/heap/base/memory-tagging.h",
    "src/heap/base/stack.h",
    "src/heap/base/worklist.h",
  ]

  configs = [ ":internal_config" ]

  public_deps = [ ":v8_libbase" ]
}

v8_source_set("v8_heap_base") {
  sources = [
    "src/heap/base/active-system-pages.cc",
    "src/heap/base/incremental-marking-schedule.cc",
    "src/heap/base/memory-tagging.cc",
    "src/heap/base/stack.cc",
    "src/heap/base/worklist.cc",
  ]

  if (is_clang || !is_win) {
    if (current_cpu == "x64") {
      sources += [ "src/heap/base/asm/x64/push_registers_asm.cc" ]
    } else if (current_cpu == "x86") {
      sources += [ "src/heap/base/asm/ia32/push_registers_asm.cc" ]
    } else if (current_cpu == "arm") {
      sources += [ "src/heap/base/asm/arm/push_registers_asm.cc" ]
    } else if (current_cpu == "arm64") {
      sources += [ "src/heap/base/asm/arm64/push_registers_asm.cc" ]
    } else if (current_cpu == "ppc64") {
      sources += [ "src/heap/base/asm/ppc/push_registers_asm.cc" ]
    } else if (current_cpu == "s390x") {
      sources += [ "src/heap/base/asm/s390/push_registers_asm.cc" ]
    } else if (current_cpu == "mips64el") {
      sources += [ "src/heap/base/asm/mips64/push_registers_asm.cc" ]
    } else if (current_cpu == "loong64") {
      sources += [ "src/heap/base/asm/loong64/push_registers_asm.cc" ]
    } else if (current_cpu == "riscv64" || current_cpu == "riscv32") {
      sources += [ "src/heap/base/asm/riscv/push_registers_asm.cc" ]
    }
  } else if (is_win) {
    if (current_cpu == "x64") {
      sources += [ "src/heap/base/asm/x64/push_registers_masm.asm" ]
    } else if (current_cpu == "x86") {
      sources += [ "src/heap/base/asm/ia32/push_registers_masm.asm" ]
    } else if (current_cpu == "arm64") {
      sources += [ "src/heap/base/asm/arm64/push_registers_masm.S" ]
    }
  }

  configs = [ ":internal_config" ]

  deps = [ ":v8_config_headers" ]

  public_deps = [
    ":v8_heap_base_headers",
    ":v8_libbase",
  ]
}

# This is split out to be a non-code containing target that the Chromium browser
# can depend upon to get basic cppgc types.
v8_header_set("cppgc_headers") {
  configs = [ ":internal_config" ]
  public_configs = [
    ":v8_header_features",
    ":cppgc_header_features",
  ]

  sources = [
    "include/cppgc/allocation.h",
    "include/cppgc/common.h",
    "include/cppgc/cross-thread-persistent.h",
    "include/cppgc/custom-space.h",
    "include/cppgc/default-platform.h",
    "include/cppgc/ephemeron-pair.h",
    "include/cppgc/explicit-management.h",
    "include/cppgc/garbage-collected.h",
    "include/cppgc/heap-consistency.h",
    "include/cppgc/heap-handle.h",
    "include/cppgc/heap-state.h",
    "include/cppgc/heap-statistics.h",
    "include/cppgc/heap.h",
    "include/cppgc/internal/api-constants.h",
    "include/cppgc/internal/atomic-entry-flag.h",
    "include/cppgc/internal/base-page-handle.h",
    "include/cppgc/internal/compiler-specific.h",
    "include/cppgc/internal/finalizer-trait.h",
    "include/cppgc/internal/gc-info.h",
    "include/cppgc/internal/member-storage.h",
    "include/cppgc/internal/name-trait.h",
    "include/cppgc/internal/persistent-node.h",
    "include/cppgc/internal/pointer-policies.h",
    "include/cppgc/internal/write-barrier.h",
    "include/cppgc/liveness-broker.h",
    "include/cppgc/macros.h",
    "include/cppgc/member.h",
    "include/cppgc/name-provider.h",
    "include/cppgc/object-size-trait.h",
    "include/cppgc/persistent.h",
    "include/cppgc/platform.h",
    "include/cppgc/prefinalizer.h",
    "include/cppgc/process-heap-statistics.h",
    "include/cppgc/sentinel-pointer.h",
    "include/cppgc/source-location.h",

    # TODO(v8:11952): Remove the testing header here once depending on both,
    # //v8:v8 and //v8:v8_for_testing does not result in ODR violations.
    "include/cppgc/testing.h",
    "include/cppgc/trace-trait.h",
    "include/cppgc/type-traits.h",
    "include/cppgc/visitor.h",
  ]

  if (cppgc_enable_caged_heap) {
    sources += [ "include/cppgc/internal/caged-heap-local-data.h" ]
    sources += [ "include/cppgc/internal/caged-heap.h" ]
  }

  deps = [
    ":v8_libbase",
    ":v8_libplatform",
  ]

  public_deps = [ ":v8_config_headers" ]
}

v8_source_set("cppgc_base") {
  visibility = [ ":*" ]

  sources = [
    "src/heap/cppgc/allocation.cc",
    "src/heap/cppgc/compaction-worklists.cc",
    "src/heap/cppgc/compaction-worklists.h",
    "src/heap/cppgc/compactor.cc",
    "src/heap/cppgc/compactor.h",
    "src/heap/cppgc/concurrent-marker.cc",
    "src/heap/cppgc/concurrent-marker.h",
    "src/heap/cppgc/explicit-management.cc",
    "src/heap/cppgc/free-list.cc",
    "src/heap/cppgc/free-list.h",
    "src/heap/cppgc/garbage-collector.h",
    "src/heap/cppgc/gc-info-table.cc",
    "src/heap/cppgc/gc-info-table.h",
    "src/heap/cppgc/gc-info.cc",
    "src/heap/cppgc/gc-invoker.cc",
    "src/heap/cppgc/gc-invoker.h",
    "src/heap/cppgc/globals.h",
    "src/heap/cppgc/heap-base.cc",
    "src/heap/cppgc/heap-base.h",
    "src/heap/cppgc/heap-config.h",
    "src/heap/cppgc/heap-consistency.cc",
    "src/heap/cppgc/heap-growing.cc",
    "src/heap/cppgc/heap-growing.h",
    "src/heap/cppgc/heap-object-header.cc",
    "src/heap/cppgc/heap-object-header.h",
    "src/heap/cppgc/heap-page.cc",
    "src/heap/cppgc/heap-page.h",
    "src/heap/cppgc/heap-space.cc",
    "src/heap/cppgc/heap-space.h",
    "src/heap/cppgc/heap-state.cc",
    "src/heap/cppgc/heap-statistics-collector.cc",
    "src/heap/cppgc/heap-statistics-collector.h",
    "src/heap/cppgc/heap-visitor.h",
    "src/heap/cppgc/heap.cc",
    "src/heap/cppgc/heap.h",
    "src/heap/cppgc/liveness-broker.cc",
    "src/heap/cppgc/liveness-broker.h",
    "src/heap/cppgc/logging.cc",
    "src/heap/cppgc/marker.cc",
    "src/heap/cppgc/marker.h",
    "src/heap/cppgc/marking-state.cc",
    "src/heap/cppgc/marking-state.h",
    "src/heap/cppgc/marking-verifier.cc",
    "src/heap/cppgc/marking-verifier.h",
    "src/heap/cppgc/marking-visitor.cc",
    "src/heap/cppgc/marking-visitor.h",
    "src/heap/cppgc/marking-worklists.cc",
    "src/heap/cppgc/marking-worklists.h",
    "src/heap/cppgc/member-storage.cc",
    "src/heap/cppgc/member-storage.h",
    "src/heap/cppgc/memory.cc",
    "src/heap/cppgc/memory.h",
    "src/heap/cppgc/metric-recorder.h",
    "src/heap/cppgc/name-trait.cc",
    "src/heap/cppgc/object-allocator.cc",
    "src/heap/cppgc/object-allocator.h",
    "src/heap/cppgc/object-poisoner.h",
    "src/heap/cppgc/object-size-trait.cc",
    "src/heap/cppgc/object-start-bitmap.h",
    "src/heap/cppgc/object-view.h",
    "src/heap/cppgc/page-memory.cc",
    "src/heap/cppgc/page-memory.h",
    "src/heap/cppgc/persistent-node.cc",
    "src/heap/cppgc/platform.cc",
    "src/heap/cppgc/platform.h",
    "src/heap/cppgc/pointer-policies.cc",
    "src/heap/cppgc/prefinalizer-handler.cc",
    "src/heap/cppgc/prefinalizer-handler.h",
    "src/heap/cppgc/process-heap-statistics.cc",
    "src/heap/cppgc/process-heap-statistics.h",
    "src/heap/cppgc/process-heap.cc",
    "src/heap/cppgc/process-heap.h",
    "src/heap/cppgc/raw-heap.cc",
    "src/heap/cppgc/raw-heap.h",
    "src/heap/cppgc/remembered-set.cc",
    "src/heap/cppgc/remembered-set.h",
    "src/heap/cppgc/stats-collector.cc",
    "src/heap/cppgc/stats-collector.h",
    "src/heap/cppgc/sweeper.cc",
    "src/heap/cppgc/sweeper.h",
    "src/heap/cppgc/task-handle.h",
    "src/heap/cppgc/unmarker.h",

    # TODO(v8:11952): Remove the testing header here once depending on both,
    # //v8:v8 and //v8:v8_for_testing does not result in ODR violations.
    "src/heap/cppgc/testing.cc",
    "src/heap/cppgc/trace-event.h",
    "src/heap/cppgc/trace-trait.cc",
    "src/heap/cppgc/virtual-memory.cc",
    "src/heap/cppgc/virtual-memory.h",
    "src/heap/cppgc/visitor.cc",
    "src/heap/cppgc/visitor.h",
    "src/heap/cppgc/write-barrier.cc",
    "src/heap/cppgc/write-barrier.h",
  ]

  if (cppgc_enable_caged_heap) {
    sources += [
      "src/heap/cppgc/caged-heap-local-data.cc",
      "src/heap/cppgc/caged-heap.cc",
      "src/heap/cppgc/caged-heap.h",
    ]
  }

  configs = [
    ":internal_config",
    ":cppgc_base_config",
  ]

  public_deps = [
    ":cppgc_headers",
    ":v8_heap_base",
    ":v8_libbase",
    ":v8_libplatform",
  ]

  if (cppgc_is_standalone && !v8_use_perfetto) {
    sources += [ "//base/trace_event/common/trace_event_common.h" ]
  } else {
    public_deps += [ ":v8_tracing" ]
  }

  if (v8_use_perfetto) {
    sources += [
      "src/tracing/trace-categories.cc",
      "src/tracing/trace-categories.h",
    ]
  }
}

if (v8_check_header_includes) {
  # This file will be generated by tools/generate-header-include-checks.py
  # if the "check_v8_header_includes" gclient variable is set.
  import("check-header-includes/sources.gni")
  v8_source_set("check_headers") {
    configs = [ ":internal_config" ]
    sources = check_header_includes_sources

    # Any rules that contain headers files should be added here either directly
    # or indirectly by including something that has it transitively in its
    # public_deps.
    deps = [
      ":d8",
      ":mksnapshot",
      ":torque_base",
      ":torque_ls_base",
      ":v8_base_without_compiler",
      ":v8_bigint",
      ":v8_headers",
      ":v8_initializers",
      ":v8_internal_headers",
      ":v8_libbase",
      ":v8_maybe_icu",
      ":v8_version",
      ":wee8",
      "src/inspector:inspector",
      "src/inspector:inspector_string_conversions",
    ]
  }
}

###############################################################################
# Produce a single static library for embedders
#

if (v8_monolithic) {
  assert(!is_component_build,
         "Set `is_component_build = false` for v8_monolithic.")

  # Using external startup data would produce separate files.
  assert(!v8_use_external_startup_data,
         "Set `v8_use_external_startup_data = false` for v8_monolithic.")
  v8_static_library("v8_monolith") {
    deps = [
      ":v8",
      ":v8_libbase",
      ":v8_libplatform",
      "//build/win:default_exe_manifest",
    ]

    configs = [ ":internal_config" ]
  }
}

if (v8_enable_webassembly) {
  v8_static_library("wee8") {
    deps = [
      ":v8_base",
      ":v8_libbase",
      ":v8_libplatform",
      ":v8_shared_internal_headers",
      ":v8_snapshot",
      "//build/win:default_exe_manifest",
    ]
    if (v8_enable_vtunejit) {
      deps += [ "src/third_party/vtune:v8_vtune" ]
    }

    # TODO: v8dll-main.cc equivalent for shared library builds

    configs = [ ":internal_config" ]

    sources = [
      ### gcmole(all) ###
      "src/wasm/c-api.cc",
      "src/wasm/c-api.h",
      "third_party/wasm-api/wasm.h",
      "third_party/wasm-api/wasm.hh",
    ]
  }
}

###############################################################################
# Executables
#

if (current_toolchain == v8_generator_toolchain) {
  v8_executable("bytecode_builtins_list_generator") {
    visibility = [ ":*" ]  # Only targets in this file can depend on this.

    include_dirs = [ "." ]

    sources = [
      "src/builtins/generate-bytecodes-builtins-list.cc",
      "src/interpreter/bytecode-operands.cc",
      "src/interpreter/bytecode-operands.h",
      "src/interpreter/bytecode-traits.h",
      "src/interpreter/bytecodes.cc",
      "src/interpreter/bytecodes.h",
    ]

    configs = [ ":internal_config" ]

    deps = [
      ":v8_libbase",
      ":v8_shared_internal_headers",
      "//build/win:default_exe_manifest",
    ]
  }
}

if (current_toolchain == v8_snapshot_toolchain) {
  v8_executable("mksnapshot") {
    sources = [
      "src/snapshot/embedded/embedded-empty.cc",
      "src/snapshot/embedded/embedded-file-writer.cc",
      "src/snapshot/embedded/embedded-file-writer.h",
      "src/snapshot/embedded/platform-embedded-file-writer-aix.cc",
      "src/snapshot/embedded/platform-embedded-file-writer-aix.h",
      "src/snapshot/embedded/platform-embedded-file-writer-base.cc",
      "src/snapshot/embedded/platform-embedded-file-writer-base.h",
      "src/snapshot/embedded/platform-embedded-file-writer-generic.cc",
      "src/snapshot/embedded/platform-embedded-file-writer-generic.h",
      "src/snapshot/embedded/platform-embedded-file-writer-mac.cc",
      "src/snapshot/embedded/platform-embedded-file-writer-mac.h",
      "src/snapshot/embedded/platform-embedded-file-writer-win.cc",
      "src/snapshot/embedded/platform-embedded-file-writer-win.h",
      "src/snapshot/mksnapshot.cc",
      "src/snapshot/snapshot-empty.cc",
      "src/snapshot/static-roots-gen.cc",
      "src/snapshot/static-roots-gen.h",
    ]

    if (v8_control_flow_integrity) {
      sources += [ "src/deoptimizer/deoptimizer-cfi-empty.cc" ]
    }

    configs = [ ":internal_config" ]

    deps = [
      ":v8_base_without_compiler",
      ":v8_compiler_for_mksnapshot",
      ":v8_init",
      ":v8_libbase",
      ":v8_libplatform",
      ":v8_maybe_icu",
      ":v8_shared_internal_headers",
      ":v8_tracing",
      ":v8_turboshaft",
      "//build/win:default_exe_manifest",
    ]
  }
}

if (current_toolchain == v8_snapshot_toolchain) {
  v8_executable("torque") {
    visibility = [ ":*" ]  # Only targets in this file can depend on this.

    sources = [ "src/torque/torque.cc" ]

    deps = [
      ":torque_base",
      "//build/win:default_exe_manifest",
    ]

    # The use of exceptions for Torque in violation of the Chromium style-guide
    # is justified by the fact that it is only used from the non-essential
    # language server and can be removed anytime if it causes problems.
    configs = [
      ":internal_config",
      "//build/config/compiler:exceptions",
      "//build/config/compiler:rtti",
    ]

    remove_configs = [
      "//build/config/compiler:no_exceptions",
      "//build/config/compiler:no_rtti",
    ]
  }
}

v8_executable("torque-language-server") {
  visibility = [ ":*" ]  # Only targets in this file can depend on this.

  sources = [ "src/torque/ls/torque-language-server.cc" ]

  deps = [
    ":torque_base",
    ":torque_ls_base",
    "//build/win:default_exe_manifest",
  ]

  # The use of exceptions for Torque in violation of the Chromium style-guide
  # is justified by the fact that it is only used from the non-essential
  # language server and can be removed anytime if it causes problems.
  configs = [
    ":internal_config",
    "//build/config/compiler:exceptions",
    "//build/config/compiler:rtti",
  ]

  remove_configs = [
    "//build/config/compiler:no_exceptions",
    "//build/config/compiler:no_rtti",
  ]
}

if (v8_enable_i18n_support) {
  if (current_toolchain == v8_generator_toolchain) {
    v8_executable("gen-regexp-special-case") {
      visibility = [ ":*" ]  # Only targets in this file can depend on this.

      sources = [
        "src/regexp/gen-regexp-special-case.cc",
        "src/regexp/special-case.h",
      ]

      deps = [
        ":v8_libbase",
        ":v8_shared_internal_headers",
        "//build/win:default_exe_manifest",
        v8_icu_path,
      ]

      configs = [ ":internal_config" ]
    }
  }

  action("run_gen-regexp-special-case") {
    visibility = [ ":*" ]  # Only targets in this file can depend on this.

    script = "tools/run.py"

    deps = [ ":gen-regexp-special-case($v8_generator_toolchain)" ]

    output_file = "$target_gen_dir/src/regexp/special-case.cc"

    outputs = [ output_file ]

    args = [
      "./" + rebase_path(
              get_label_info(
                      ":gen-regexp-special-case($v8_generator_toolchain)",
                      "root_out_dir") + "/gen-regexp-special-case",
              root_build_dir),
      rebase_path(output_file, root_build_dir),
    ]
  }
}

###############################################################################
# Public targets
#

want_v8_shell =
    (current_toolchain == host_toolchain && v8_toolset_for_shell == "host") ||
    (current_toolchain == v8_snapshot_toolchain &&
     v8_toolset_for_shell == "host") ||
    (current_toolchain != host_toolchain && v8_toolset_for_shell == "target")

group("gn_all") {
  testonly = true

  deps = [
    ":d8",
    ":v8_fuzzers",
    ":v8_hello_world",
    ":v8_sample_process",
    "test:gn_all",
    "tools:gn_all",
  ]

  if (v8_custom_deps != "") {
    # Custom dependency from directory under v8/custom_deps.
    deps += [ v8_custom_deps ]
  }

  if (want_v8_shell) {
    deps += [ ":v8_shell" ]
  }

  if (v8_check_header_includes) {
    deps += [ ":check_headers" ]
  }
}

group("v8_python_base") {
  data = [ ".vpython3" ]
}

group("v8_clusterfuzz") {
  testonly = true

  deps = [
    ":d8",
    ":v8_simple_inspector_fuzzer",
    "tools/clusterfuzz/trials:v8_clusterfuzz_resources",
  ]

  if (v8_multi_arch_build) {
    deps += [
      ":d8(//build/toolchain/linux:clang_x64)",
      ":d8(//build/toolchain/linux:clang_x64_v8_arm64)",
      ":d8(//build/toolchain/linux:clang_x86)",
      ":d8(//build/toolchain/linux:clang_x86_v8_arm)",
      ":d8(tools/clusterfuzz/foozzie/toolchain:clang_x64_pointer_compression)",
    ]
  }
}

# Targets we ensure work with gcc. The aim is to keep this list small to have
# a fast overall compile time.
group("v8_gcc_light") {
  testonly = true

  deps = [ ":d8" ]
}

group("v8_archive") {
  testonly = true

  deps = [ ":d8" ]

  if (!is_win) {
    # On windows, cctest doesn't link with v8_static_library.
    deps += [ "test/cctest:cctest" ]
  }
}

# TODO(dglazkov): Remove the "!build_with_chromium" condition once this clause
# is removed from Chromium.
if (is_fuchsia && !build_with_chromium) {
  import("//build/config/fuchsia/generate_runner_scripts.gni")
  import("//third_party/fuchsia-sdk/sdk/build/component.gni")
  import("//third_party/fuchsia-sdk/sdk/build/package.gni")

  fuchsia_component("d8_component") {
    testonly = true
    manifest = "gni/v8.cml"
    data_deps = [ ":d8" ]
  }

  fuchsia_package("d8_pkg") {
    testonly = true
    package_name = "d8"
    deps = [ ":d8_component" ]
  }

  fuchsia_package_installer("d8_fuchsia") {
    testonly = true
    package = ":d8_pkg"
    package_name = "d8"
  }
}

group("v8_fuzzers") {
  testonly = true
  data_deps = [
    ":v8_simple_inspector_fuzzer",
    ":v8_simple_json_fuzzer",
    ":v8_simple_parser_fuzzer",
    ":v8_simple_regexp_fuzzer",
  ]

  if (v8_enable_webassembly) {
    data_deps += [
      ":v8_simple_multi_return_fuzzer",
      ":v8_simple_wasm_async_fuzzer",
      ":v8_simple_wasm_code_fuzzer",
      ":v8_simple_wasm_compile_fuzzer",
      ":v8_simple_wasm_fuzzer",
      ":v8_simple_wasm_init_expr_fuzzer",
      ":v8_simple_wasm_streaming_fuzzer",
    ]
  }
}

if (is_component_build) {
  v8_component("v8") {
    sources = [ "src/utils/v8dll-main.cc" ]

    public_deps = [
      ":v8_base",
      ":v8_snapshot",
    ]

    configs = [ ":internal_config" ]

    public_configs = [ ":external_config" ]
  }

  v8_component("v8_for_testing") {
    testonly = true

    sources = [ "src/utils/v8dll-main.cc" ]

    public_deps = [
      ":torque_base",
      ":torque_ls_base",
      ":v8_base",
      ":v8_headers",
      ":v8_snapshot",
    ]

    if (v8_enable_turbofan) {
      # For cctest/test-serialize.
      public_deps += [ ":v8_initializers" ]
    }

    configs = [ ":internal_config" ]

    public_configs = [ ":external_config" ]
  }

  v8_component("cppgc") {
    public_deps = [ ":cppgc_base" ]

    if (!cppgc_is_standalone) {
      deps = [ ":v8" ]
    }

    configs = []
    public_configs = [ ":external_config" ]
  }

  if (cppgc_is_standalone) {
    v8_component("cppgc_for_testing") {
      testonly = true

      public_deps = [ ":cppgc_base" ]

      configs = []
      public_configs = [ ":external_config" ]
    }
  }

  v8_component("v8_heap_base_for_testing") {
    testonly = true

    public_deps = [ ":v8_heap_base" ]

    configs = []
    public_configs = [ ":external_config" ]
  }
} else {
  group("v8") {
    public_deps = [
      ":v8_base",
      ":v8_snapshot",
    ]

    public_configs = [ ":external_config" ]
  }

  group("v8_for_testing") {
    testonly = true

    public_deps = [
      ":torque_base",
      ":torque_ls_base",
      ":v8_base",
      ":v8_snapshot",
    ]

    if (v8_enable_turbofan) {
      # For cctest/test-serialize.
      public_deps += [ ":v8_initializers" ]
    }

    public_configs = [ ":external_config" ]
  }

  group("cppgc") {
    public_deps = [ ":cppgc_base" ]

    if (!cppgc_is_standalone) {
      deps = [ ":v8" ]
    }

    public_configs = [ ":external_config" ]
  }

  if (cppgc_is_standalone) {
    group("cppgc_for_testing") {
      testonly = true

      public_deps = [ ":cppgc_base" ]

      public_configs = [ ":external_config" ]
    }
  }

  group("v8_heap_base_for_testing") {
    testonly = true

    public_deps = [ ":v8_heap_base" ]

    public_configs = [ ":external_config" ]
  }
}

v8_executable("d8") {
  sources = [
    "src/d8/async-hooks-wrapper.cc",
    "src/d8/async-hooks-wrapper.h",
    "src/d8/d8-console.cc",
    "src/d8/d8-console.h",
    "src/d8/d8-js.cc",
    "src/d8/d8-platforms.cc",
    "src/d8/d8-platforms.h",
    "src/d8/d8-test.cc",
    "src/d8/d8.cc",
    "src/d8/d8.h",
  ]

  configs = [
    # Note: don't use :internal_config here because this target will get
    # the :external_config applied to it by virtue of depending on :v8, and
    # you can't have both applied to the same target.
    ":internal_config_base",
    ":v8_tracing_config",
  ]

  deps = [
    ":v8",
    ":v8_libbase",
    ":v8_libplatform",
    ":v8_tracing",
    "//build/win:default_exe_manifest",
  ]

  if (is_posix || is_fuchsia) {
    sources += [ "src/d8/d8-posix.cc" ]
  } else if (is_win) {
    sources += [ "src/d8/d8-windows.cc" ]
  }

  if (v8_correctness_fuzzer) {
    deps += [ "tools/clusterfuzz/foozzie:v8_correctness_fuzzer_resources" ]
  }

  defines = []

  if (v8_enable_vtunejit) {
    deps += [ "src/third_party/vtune:v8_vtune" ]
  }
}

v8_executable("v8_hello_world") {
  sources = [ "samples/hello-world.cc" ]

  configs = [
    # Note: don't use :internal_config here because this target will get
    # the :external_config applied to it by virtue of depending on :v8, and
    # you can't have both applied to the same target.
    ":internal_config_base",
  ]

  deps = [
    ":v8",
    ":v8_libbase",
    ":v8_libplatform",
    "//build/win:default_exe_manifest",
  ]
}

v8_executable("v8_sample_process") {
  sources = [ "samples/process.cc" ]

  configs = [
    # Note: don't use :internal_config here because this target will get
    # the :external_config applied to it by virtue of depending on :v8, and
    # you can't have both applied to the same target.
    ":internal_config_base",
  ]

  deps = [
    ":v8",
    ":v8_libbase",
    ":v8_libplatform",
    "//build/win:default_exe_manifest",
  ]
}

if (want_v8_shell) {
  v8_executable("v8_shell") {
    sources = [ "samples/shell.cc" ]

    configs = [
      # Note: don't use :internal_config here because this target will get
      # the :external_config applied to it by virtue of depending on :v8, and
      # you can't have both applied to the same target.
      ":internal_config_base",
    ]

    deps = [
      ":v8",
      ":v8_libbase",
      ":v8_libplatform",
      "//build/win:default_exe_manifest",
    ]
  }
}

v8_executable("cppgc_hello_world") {
  sources = [ "samples/cppgc/hello-world.cc" ]

  if (v8_current_cpu == "riscv64" || v8_current_cpu == "riscv32") {
    if (!is_clang) {
      libs = [ "atomic" ]
    }
  }

  configs = [
    # Note: don't use :internal_config here because this target will get
    # the :external_config applied to it by virtue of depending on :cppgc, and
    # you can't have both applied to the same target.
    ":internal_config_base",
    ":cppgc_base_config",
  ]

  deps = [ ":cppgc" ]
  if (!cppgc_is_standalone) {
    deps += [
      ":v8",
      "//build/win:default_exe_manifest",
    ]
  }
}

template("v8_fuzzer") {
  name = target_name
  forward_variables_from(invoker, "*")
  v8_executable("v8_simple_" + name) {
    deps = [
      ":" + name,
      "//build/win:default_exe_manifest",
    ]

    sources = [ "test/fuzzer/fuzzer.cc" ]

    configs = [ ":external_config" ]
  }
}

v8_source_set("json_fuzzer") {
  sources = [ "test/fuzzer/json.cc" ]

  deps = [ ":fuzzer_support" ]

  configs = [
    ":external_config",
    ":internal_config_base",
  ]
}

v8_fuzzer("json_fuzzer") {
}

v8_source_set("parser_fuzzer") {
  sources = [ "test/fuzzer/parser.cc" ]

  deps = [ ":fuzzer_support" ]

  configs = [
    ":external_config",
    ":internal_config_base",
  ]
}

v8_fuzzer("parser_fuzzer") {
}

v8_source_set("regexp_fuzzer") {
  sources = [ "test/fuzzer/regexp.cc" ]

  deps = [ ":fuzzer_support" ]

  configs = [
    ":external_config",
    ":internal_config_base",
  ]
}

v8_fuzzer("regexp_fuzzer") {
}

if (v8_enable_webassembly) {
  v8_source_set("multi_return_fuzzer") {
    sources = [ "test/fuzzer/multi-return.cc" ]

    deps = [ ":fuzzer_support" ]

    configs = [
      ":external_config",
      ":internal_config_base",
    ]
  }

  v8_fuzzer("multi_return_fuzzer") {
  }

  v8_source_set("wasm_test_common") {
    sources = [
      "test/common/flag-utils.h",
      "test/common/wasm/flag-utils.h",
      "test/common/wasm/wasm-module-runner.cc",
      "test/common/wasm/wasm-module-runner.h",
    ]

    deps = [
      ":generate_bytecode_builtins_list",
      ":run_torque",
      ":v8_internal_headers",
      ":v8_libbase",
      ":v8_shared_internal_headers",
      ":v8_tracing",
    ]

    public_deps = [
      ":v8_abseil",
      ":v8_maybe_icu",
    ]

    configs = [
      ":external_config",
      ":internal_config_base",
    ]
  }

  v8_source_set("wasm_fuzzer") {
    sources = [ "test/fuzzer/wasm.cc" ]

    deps = [
      ":fuzzer_support",
      ":lib_wasm_fuzzer_common",
      ":wasm_test_common",
    ]

    configs = [
      ":external_config",
      ":internal_config_base",
    ]
  }

  v8_fuzzer("wasm_fuzzer") {
  }

  v8_source_set("wasm_async_fuzzer") {
    sources = [ "test/fuzzer/wasm-async.cc" ]

    deps = [
      ":fuzzer_support",
      ":lib_wasm_fuzzer_common",
      ":wasm_test_common",
    ]

    configs = [
      ":external_config",
      ":internal_config_base",
    ]
  }

  v8_fuzzer("wasm_async_fuzzer") {
  }

  v8_source_set("wasm_code_fuzzer") {
    sources = [
      "test/common/wasm/test-signatures.h",
      "test/fuzzer/wasm-code.cc",
    ]

    deps = [
      ":fuzzer_support",
      ":lib_wasm_fuzzer_common",
      ":wasm_test_common",
    ]

    configs = [
      ":external_config",
      ":internal_config_base",
    ]
  }

  v8_fuzzer("wasm_code_fuzzer") {
  }

  v8_source_set("lib_wasm_fuzzer_common") {
    sources = [
      "test/fuzzer/wasm-fuzzer-common.cc",
      "test/fuzzer/wasm-fuzzer-common.h",
    ]

    deps = [
      ":fuzzer_support",
      ":generate_bytecode_builtins_list",
      ":run_torque",
      ":v8_internal_headers",
      ":v8_tracing",
      ":wasm_test_common",
    ]

    public_deps = [
      ":v8_abseil",
      ":v8_maybe_icu",
    ]

    configs = [
      ":external_config",
      ":internal_config_base",
    ]
  }

  v8_source_set("wasm_compile_fuzzer") {
    sources = [
      "test/common/wasm/test-signatures.h",
      "test/fuzzer/wasm-compile.cc",
    ]

    deps = [
      ":fuzzer_support",
      ":lib_wasm_fuzzer_common",
      ":wasm_test_common",
    ]

    configs = [
      ":external_config",
      ":internal_config_base",
    ]
  }

  v8_fuzzer("wasm_compile_fuzzer") {
  }

  v8_source_set("wasm_streaming_fuzzer") {
    sources = [ "test/fuzzer/wasm-streaming.cc" ]

    deps = [
      ":fuzzer_support",
      ":lib_wasm_fuzzer_common",
      ":wasm_test_common",
    ]

    configs = [
      ":external_config",
      ":internal_config_base",
    ]
  }

  v8_fuzzer("wasm_streaming_fuzzer") {
  }

  v8_source_set("wasm_init_expr_fuzzer") {
    sources = [ "test/fuzzer/wasm-init-expr.cc" ]

    deps = [
      ":fuzzer_support",
      ":lib_wasm_fuzzer_common",
      ":wasm_test_common",
    ]

    configs = [
      ":external_config",
      ":internal_config_base",
    ]
  }

  v8_fuzzer("wasm_init_expr_fuzzer") {
  }
}

v8_source_set("inspector_fuzzer") {
  sources = [ "test/fuzzer/inspector-fuzzer.cc" ]

  deps = [
    ":fuzzer_support",
    "test/inspector:inspector_test",
  ]

  configs = [
    ":external_config",
    ":internal_config_base",
  ]
}

v8_fuzzer("inspector_fuzzer") {
}

# Target to build all generated .cc files.
group("v8_generated_cc_files") {
  testonly = true

  deps = [
    ":generate_bytecode_builtins_list",
    ":run_torque",
    "src/inspector:v8_generated_cc_files",
  ]
}

# Protobuf targets, used only when building outside of chromium.

if (!build_with_chromium && v8_use_perfetto) {
  # This config is applied to the autogenerated .pb.{cc,h} files in
  # proto_library.gni. This config is propagated up to the source sets
  # that depend on generated proto headers.
  config("protobuf_gen_config") {
    defines = [
      "GOOGLE_PROTOBUF_NO_RTTI",
      "GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
    ]
    cflags = [
      "-Wno-unknown-warning-option",
      "-Wno-deprecated",
      "-Wno-undef",
      "-Wno-zero-as-null-pointer-constant",
      "-Wno-thread-safety-attributes",
    ]
    include_dirs = [ "third_party/protobuf/src" ]
  }

  # Configuration used to build libprotobuf_* and the protoc compiler.
  config("protobuf_config") {
    # Apply the lighter supressions and macro definitions from above.
    configs = [ ":protobuf_gen_config" ]

    if (!is_win) {
      defines = [ "HAVE_PTHREAD=1" ]
    }
    if (is_clang) {
      cflags = [
        "-Wno-unused-private-field",
        "-Wno-unused-function",
        "-Wno-inconsistent-missing-override",
        "-Wno-unknown-warning-option",
        "-Wno-enum-compare-switch",
        "-Wno-user-defined-warnings",
        "-Wno-tautological-constant-compare",
      ]
    }
    if (is_win && is_clang) {
      cflags += [ "-Wno-microsoft-unqualified-friend" ]
    }
  }

  source_set("protobuf_lite") {
    sources = [
      "third_party/protobuf/src/google/protobuf/any_lite.cc",
      "third_party/protobuf/src/google/protobuf/arena.cc",
      "third_party/protobuf/src/google/protobuf/arena.h",
      "third_party/protobuf/src/google/protobuf/arena_impl.h",
      "third_party/protobuf/src/google/protobuf/arenastring.h",
      "third_party/protobuf/src/google/protobuf/extension_set.cc",
      "third_party/protobuf/src/google/protobuf/extension_set.h",
      "third_party/protobuf/src/google/protobuf/generated_enum_util.cc",
      "third_party/protobuf/src/google/protobuf/generated_enum_util.h",
      "third_party/protobuf/src/google/protobuf/generated_message_table_driven_lite.cc",
      "third_party/protobuf/src/google/protobuf/generated_message_table_driven_lite.h",
      "third_party/protobuf/src/google/protobuf/generated_message_util.cc",
      "third_party/protobuf/src/google/protobuf/generated_message_util.h",
      "third_party/protobuf/src/google/protobuf/has_bits.h",
      "third_party/protobuf/src/google/protobuf/implicit_weak_message.cc",
      "third_party/protobuf/src/google/protobuf/implicit_weak_message.h",
      "third_party/protobuf/src/google/protobuf/inlined_string_field.h",
      "third_party/protobuf/src/google/protobuf/io/coded_stream.cc",
      "third_party/protobuf/src/google/protobuf/io/coded_stream.h",
      "third_party/protobuf/src/google/protobuf/io/coded_stream_inl.h",
      "third_party/protobuf/src/google/protobuf/io/io_win32.cc",
      "third_party/protobuf/src/google/protobuf/io/io_win32.h",
      "third_party/protobuf/src/google/protobuf/io/strtod.cc",
      "third_party/protobuf/src/google/protobuf/io/strtod.h",
      "third_party/protobuf/src/google/protobuf/io/zero_copy_stream.cc",
      "third_party/protobuf/src/google/protobuf/io/zero_copy_stream.h",
      "third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc",
      "third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h",
      "third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc",
      "third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h",
      "third_party/protobuf/src/google/protobuf/map.h",
      "third_party/protobuf/src/google/protobuf/map_entry_lite.h",
      "third_party/protobuf/src/google/protobuf/map_field_lite.h",
      "third_party/protobuf/src/google/protobuf/map_type_handler.h",
      "third_party/protobuf/src/google/protobuf/message_lite.cc",
      "third_party/protobuf/src/google/protobuf/message_lite.h",
      "third_party/protobuf/src/google/protobuf/repeated_field.cc",
      "third_party/protobuf/src/google/protobuf/repeated_field.h",
      "third_party/protobuf/src/google/protobuf/stubs/bytestream.cc",
      "third_party/protobuf/src/google/protobuf/stubs/bytestream.h",
      "third_party/protobuf/src/google/protobuf/stubs/callback.h",
      "third_party/protobuf/src/google/protobuf/stubs/casts.h",
      "third_party/protobuf/src/google/protobuf/stubs/common.cc",
      "third_party/protobuf/src/google/protobuf/stubs/common.h",
      "third_party/protobuf/src/google/protobuf/stubs/fastmem.h",
      "third_party/protobuf/src/google/protobuf/stubs/hash.h",
      "third_party/protobuf/src/google/protobuf/stubs/int128.cc",
      "third_party/protobuf/src/google/protobuf/stubs/int128.h",
      "third_party/protobuf/src/google/protobuf/stubs/logging.h",
      "third_party/protobuf/src/google/protobuf/stubs/macros.h",
      "third_party/protobuf/src/google/protobuf/stubs/map_util.h",
      "third_party/protobuf/src/google/protobuf/stubs/mutex.h",
      "third_party/protobuf/src/google/protobuf/stubs/once.h",
      "third_party/protobuf/src/google/protobuf/stubs/platform_macros.h",
      "third_party/protobuf/src/google/protobuf/stubs/port.h",
      "third_party/protobuf/src/google/protobuf/stubs/status.cc",
      "third_party/protobuf/src/google/protobuf/stubs/status.h",
      "third_party/protobuf/src/google/protobuf/stubs/status_macros.h",
      "third_party/protobuf/src/google/protobuf/stubs/statusor.cc",
      "third_party/protobuf/src/google/protobuf/stubs/statusor.h",
      "third_party/protobuf/src/google/protobuf/stubs/stl_util.h",
      "third_party/protobuf/src/google/protobuf/stubs/stringpiece.cc",
      "third_party/protobuf/src/google/protobuf/stubs/stringpiece.h",
      "third_party/protobuf/src/google/protobuf/stubs/stringprintf.cc",
      "third_party/protobuf/src/google/protobuf/stubs/stringprintf.h",
      "third_party/protobuf/src/google/protobuf/stubs/structurally_valid.cc",
      "third_party/protobuf/src/google/protobuf/stubs/strutil.cc",
      "third_party/protobuf/src/google/protobuf/stubs/strutil.h",
      "third_party/protobuf/src/google/protobuf/stubs/template_util.h",
      "third_party/protobuf/src/google/protobuf/stubs/time.cc",
      "third_party/protobuf/src/google/protobuf/stubs/time.h",
      "third_party/protobuf/src/google/protobuf/wire_format_lite.cc",
      "third_party/protobuf/src/google/protobuf/wire_format_lite.h",
    ]
    configs -= [ "//build/config/compiler:chromium_code" ]
    configs += [
      "//build/config/compiler:no_chromium_code",
      ":protobuf_config",
    ]
    if (is_win) {
      configs -= [ "//build/config/win:lean_and_mean" ]
    }
    public_configs = [ ":protobuf_gen_config" ]
  }

  # This target should be used only by the protoc compiler and by test targets.
  source_set("protobuf_full") {
    deps = [ ":protobuf_lite" ]
    sources = [
      "third_party/protobuf/src/google/protobuf/any.cc",
      "third_party/protobuf/src/google/protobuf/any.h",
      "third_party/protobuf/src/google/protobuf/any.pb.cc",
      "third_party/protobuf/src/google/protobuf/any.pb.h",
      "third_party/protobuf/src/google/protobuf/api.pb.cc",
      "third_party/protobuf/src/google/protobuf/api.pb.h",
      "third_party/protobuf/src/google/protobuf/compiler/importer.cc",
      "third_party/protobuf/src/google/protobuf/compiler/importer.h",
      "third_party/protobuf/src/google/protobuf/compiler/parser.cc",
      "third_party/protobuf/src/google/protobuf/compiler/parser.h",
      "third_party/protobuf/src/google/protobuf/descriptor.cc",
      "third_party/protobuf/src/google/protobuf/descriptor.h",
      "third_party/protobuf/src/google/protobuf/descriptor.pb.cc",
      "third_party/protobuf/src/google/protobuf/descriptor.pb.h",
      "third_party/protobuf/src/google/protobuf/descriptor_database.cc",
      "third_party/protobuf/src/google/protobuf/descriptor_database.h",
      "third_party/protobuf/src/google/protobuf/duration.pb.cc",
      "third_party/protobuf/src/google/protobuf/duration.pb.h",
      "third_party/protobuf/src/google/protobuf/dynamic_message.cc",
      "third_party/protobuf/src/google/protobuf/dynamic_message.h",
      "third_party/protobuf/src/google/protobuf/empty.pb.cc",
      "third_party/protobuf/src/google/protobuf/empty.pb.h",
      "third_party/protobuf/src/google/protobuf/extension_set_heavy.cc",
      "third_party/protobuf/src/google/protobuf/field_mask.pb.cc",
      "third_party/protobuf/src/google/protobuf/field_mask.pb.h",
      "third_party/protobuf/src/google/protobuf/generated_enum_reflection.h",
      "third_party/protobuf/src/google/protobuf/generated_message_reflection.cc",
      "third_party/protobuf/src/google/protobuf/generated_message_reflection.h",
      "third_party/protobuf/src/google/protobuf/io/gzip_stream.cc",
      "third_party/protobuf/src/google/protobuf/io/gzip_stream.h",
      "third_party/protobuf/src/google/protobuf/io/printer.cc",
      "third_party/protobuf/src/google/protobuf/io/printer.h",
      "third_party/protobuf/src/google/protobuf/io/tokenizer.cc",
      "third_party/protobuf/src/google/protobuf/io/tokenizer.h",
      "third_party/protobuf/src/google/protobuf/map_entry.h",
      "third_party/protobuf/src/google/protobuf/map_field.cc",
      "third_party/protobuf/src/google/protobuf/map_field.h",
      "third_party/protobuf/src/google/protobuf/map_field_inl.h",
      "third_party/protobuf/src/google/protobuf/message.cc",
      "third_party/protobuf/src/google/protobuf/message.h",
      "third_party/protobuf/src/google/protobuf/metadata.h",
      "third_party/protobuf/src/google/protobuf/reflection.h",
      "third_party/protobuf/src/google/protobuf/reflection_internal.h",
      "third_party/protobuf/src/google/protobuf/reflection_ops.cc",
      "third_party/protobuf/src/google/protobuf/reflection_ops.h",
      "third_party/protobuf/src/google/protobuf/service.cc",
      "third_party/protobuf/src/google/protobuf/service.h",
      "third_party/protobuf/src/google/protobuf/source_context.pb.cc",
      "third_party/protobuf/src/google/protobuf/source_context.pb.h",
      "third_party/protobuf/src/google/protobuf/struct.pb.cc",
      "third_party/protobuf/src/google/protobuf/struct.pb.h",
      "third_party/protobuf/src/google/protobuf/stubs/mathlimits.cc",
      "third_party/protobuf/src/google/protobuf/stubs/mathlimits.h",
      "third_party/protobuf/src/google/protobuf/stubs/mathutil.h",
      "third_party/protobuf/src/google/protobuf/stubs/substitute.cc",
      "third_party/protobuf/src/google/protobuf/stubs/substitute.h",
      "third_party/protobuf/src/google/protobuf/text_format.cc",
      "third_party/protobuf/src/google/protobuf/text_format.h",
      "third_party/protobuf/src/google/protobuf/timestamp.pb.cc",
      "third_party/protobuf/src/google/protobuf/timestamp.pb.h",
      "third_party/protobuf/src/google/protobuf/type.pb.cc",
      "third_party/protobuf/src/google/protobuf/type.pb.h",
      "third_party/protobuf/src/google/protobuf/unknown_field_set.cc",
      "third_party/protobuf/src/google/protobuf/unknown_field_set.h",
      "third_party/protobuf/src/google/protobuf/util/field_comparator.cc",
      "third_party/protobuf/src/google/protobuf/util/field_comparator.h",
      "third_party/protobuf/src/google/protobuf/util/field_mask_util.cc",
      "third_party/protobuf/src/google/protobuf/util/field_mask_util.h",
      "third_party/protobuf/src/google/protobuf/util/internal/constants.h",
      "third_party/protobuf/src/google/protobuf/util/internal/datapiece.cc",
      "third_party/protobuf/src/google/protobuf/util/internal/datapiece.h",
      "third_party/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.cc",
      "third_party/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.h",
      "third_party/protobuf/src/google/protobuf/util/internal/error_listener.cc",
      "third_party/protobuf/src/google/protobuf/util/internal/error_listener.h",
      "third_party/protobuf/src/google/protobuf/util/internal/field_mask_utility.cc",
      "third_party/protobuf/src/google/protobuf/util/internal/field_mask_utility.h",
      "third_party/protobuf/src/google/protobuf/util/internal/json_escaping.cc",
      "third_party/protobuf/src/google/protobuf/util/internal/json_escaping.h",
      "third_party/protobuf/src/google/protobuf/util/internal/json_objectwriter.cc",
      "third_party/protobuf/src/google/protobuf/util/internal/json_objectwriter.h",
      "third_party/protobuf/src/google/protobuf/util/internal/json_stream_parser.cc",
      "third_party/protobuf/src/google/protobuf/util/internal/json_stream_parser.h",
      "third_party/protobuf/src/google/protobuf/util/internal/location_tracker.h",
      "third_party/protobuf/src/google/protobuf/util/internal/object_location_tracker.h",
      "third_party/protobuf/src/google/protobuf/util/internal/object_source.h",
      "third_party/protobuf/src/google/protobuf/util/internal/object_writer.cc",
      "third_party/protobuf/src/google/protobuf/util/internal/object_writer.h",
      "third_party/protobuf/src/google/protobuf/util/internal/proto_writer.cc",
      "third_party/protobuf/src/google/protobuf/util/internal/proto_writer.h",
      "third_party/protobuf/src/google/protobuf/util/internal/protostream_objectsource.cc",
      "third_party/protobuf/src/google/protobuf/util/internal/protostream_objectsource.h",
      "third_party/protobuf/src/google/protobuf/util/internal/protostream_objectwriter.cc",
      "third_party/protobuf/src/google/protobuf/util/internal/protostream_objectwriter.h",
      "third_party/protobuf/src/google/protobuf/util/internal/structured_objectwriter.h",
      "third_party/protobuf/src/google/protobuf/util/internal/type_info.cc",
      "third_party/protobuf/src/google/protobuf/util/internal/type_info.h",
      "third_party/protobuf/src/google/protobuf/util/internal/type_info_test_helper.cc",
      "third_party/protobuf/src/google/protobuf/util/internal/type_info_test_helper.h",
      "third_party/protobuf/src/google/protobuf/util/internal/utility.cc",
      "third_party/protobuf/src/google/protobuf/util/internal/utility.h",
      "third_party/protobuf/src/google/protobuf/util/json_util.cc",
      "third_party/protobuf/src/google/protobuf/util/json_util.h",
      "third_party/protobuf/src/google/protobuf/util/message_differencer.cc",
      "third_party/protobuf/src/google/protobuf/util/message_differencer.h",
      "third_party/protobuf/src/google/protobuf/util/time_util.cc",
      "third_party/protobuf/src/google/protobuf/util/time_util.h",
      "third_party/protobuf/src/google/protobuf/util/type_resolver.h",
      "third_party/protobuf/src/google/protobuf/util/type_resolver_util.cc",
      "third_party/protobuf/src/google/protobuf/util/type_resolver_util.h",
      "third_party/protobuf/src/google/protobuf/wire_format.cc",
      "third_party/protobuf/src/google/protobuf/wire_format.h",
      "third_party/protobuf/src/google/protobuf/wrappers.pb.cc",
      "third_party/protobuf/src/google/protobuf/wrappers.pb.h",
    ]
    configs -= [ "//build/config/compiler:chromium_code" ]
    configs += [
      "//build/config/compiler:no_chromium_code",
      ":protobuf_config",
    ]
    if (is_win) {
      configs -= [ "//build/config/win:lean_and_mean" ]
    }
    public_configs = [ ":protobuf_gen_config" ]
  }

  if (current_toolchain == host_toolchain) {
    source_set("protoc_lib") {
      deps = [ ":protobuf_full" ]
      sources = [
        "third_party/protobuf/src/google/protobuf/compiler/code_generator.cc",
        "third_party/protobuf/src/google/protobuf/compiler/code_generator.h",
        "third_party/protobuf/src/google/protobuf/compiler/command_line_interface.cc",
        "third_party/protobuf/src/google/protobuf/compiler/command_line_interface.h",
        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_enum.cc",
        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_enum.h",
        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_enum_field.cc",
        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_enum_field.h",
        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_extension.cc",
        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_extension.h",
        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_field.cc",
        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_field.h",
        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc",
        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.h",
        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_generator.cc",
        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_generator.h",
        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc",
        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.h",
        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_map_field.cc",
        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_map_field.h",
        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc",
        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_message.h",
        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_message_field.cc",
        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_message_field.h",
        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_message_layout_helper.h",
        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_options.h",
        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc",
        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.h",
        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc",
        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_primitive_field.h",
        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_service.cc",
        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_service.h",
        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_string_field.cc",
        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_string_field.h",
        "third_party/protobuf/src/google/protobuf/compiler/plugin.cc",
        "third_party/protobuf/src/google/protobuf/compiler/plugin.h",
        "third_party/protobuf/src/google/protobuf/compiler/plugin.pb.cc",
        "third_party/protobuf/src/google/protobuf/compiler/plugin.pb.h",
        "third_party/protobuf/src/google/protobuf/compiler/subprocess.cc",
        "third_party/protobuf/src/google/protobuf/compiler/subprocess.h",
        "third_party/protobuf/src/google/protobuf/compiler/zip_writer.cc",
        "third_party/protobuf/src/google/protobuf/compiler/zip_writer.h",
      ]
      configs -= [ "//build/config/compiler:chromium_code" ]
      configs += [
        "//build/config/compiler:no_chromium_code",
        ":protobuf_config",
      ]
      if (is_win) {
        configs -= [ "//build/config/win:lean_and_mean" ]
      }
      public_configs = [ ":protobuf_gen_config" ]
    }

    executable("protoc") {
      deps = [
        ":protoc_lib",
        "//build/win:default_exe_manifest",
      ]
      sources = [ "src/protobuf/protobuf-compiler-main.cc" ]
      configs -= [ "//build/config/compiler:chromium_code" ]
      configs += [ "//build/config/compiler:no_chromium_code" ]
    }
  }  # host_toolchain

  v8_component("v8_libperfetto") {
    configs = [ ":v8_tracing_config" ]
    public_configs = [ "//third_party/perfetto/gn:public_config" ]
    deps = [
      "//third_party/perfetto/src/trace_processor:storage_minimal",
      "//third_party/perfetto/src/tracing/core",

      # TODO(skyostil): Support non-POSIX platforms.
      "//third_party/perfetto/protos/perfetto/trace/track_event:zero",
      "//third_party/perfetto/src/tracing:in_process_backend",
      "//third_party/perfetto/src/tracing:platform_impl",
    ]

    public_deps = [
      "//third_party/perfetto/include/perfetto/trace_processor",
      "//third_party/perfetto/protos/perfetto/config:cpp",
      "//third_party/perfetto/protos/perfetto/trace/chrome:zero",
      "//third_party/perfetto/src/trace_processor:export_json",
      "//third_party/perfetto/src/tracing:client_api",
    ]
  }
}  # if (!build_with_chromium && v8_use_perfetto)
